Page 1 of 1
[Solved] Event triggers for text control?
Posted: Tue Nov 08, 2016 8:23 am
by owlbrudder
On a form I can add controls and they all have associated events which can trigger macros. The only type of control not having events seem to be those associated with a table - at least, the form has an associated table it can scroll through and controls on the form are tied to fields in the table. Is this right, or am I misunderstanding something?
To explain further: I would like to raise a visual flag if a certain value appears in a control as the user scrolls through the records and I was going to use control events for this, but there don't seem to be any events.
Any help would be appreciated.
Re: Event triggers for text control?
Posted: Tue Nov 08, 2016 11:48 am
by Villeroy
A table control on a form is a bundle of controls. Each column represents one control of any type. See column properties. There is no formatting for individual rows nor columns and no macro can add this missing feature. The best you can get without macros is a formatted field with conditional number format. Formatted fields are very much like numeric spreadsheet cells with the same number format attributes, e.g. red font color for negative numbers: #,##0.00;[RED]-#,##0.00
Reports can do more if you use the report builder extension or if you use Calc for database reports.
Re: Event triggers for text control?
Posted: Tue Nov 08, 2016 11:54 am
by owlbrudder
Thanks for the quick response. I have found I can manully add a text control (for example) and set its datasource as a field of the form's recordset and this control retains all its events, so I have a work-around for when I need it.
Cheers,
Doug
Re: Event triggers for text control?
Posted: Tue Nov 08, 2016 2:45 pm
by Villeroy
You can also hide and unhide form controls.
Re: Event triggers for text control?
Posted: Tue Nov 08, 2016 6:38 pm
by F3K Total
Hello,
find attached another approach, using a query to find the event and display the information in a textcontrol having the same backgroundcolor as the form itself. An information will appear, if the NUMBER is less than -50.
Re: Event triggers for text control?
Posted: Wed Nov 09, 2016 3:41 am
by owlbrudder
Villeroy wrote:hide and unhide form controls.
Good - I was counting on that for when I use a manually-created data control. I would have the standard control invisible and my control over the top of it. Thanks for the suggestion.
Re: Event triggers for text control?
Posted: Wed Nov 09, 2016 3:45 am
by owlbrudder
F3K Total wrote:find attached another approach
Thanks - that is very kind of you. I will study your technique as it sounds like a simplification of what I was planning to do.
... Later ...
F3K Total, solving the problem through SQL is a neat alternative. Now I can use either method depending on the circumstances. Thank you again.

Re: [Solved] Event triggers for text control?
Posted: Wed Nov 09, 2016 6:03 pm
by F3K Total
Hello,
find attached a combination of Villeroys idea and a query, using a number in a formatted field of a grid control to display a colored text. Looks like this:

- C.PNG (7.94 KiB) Viewed 4985 times
The query gives back 0 or 1, and the field is formatted like this:
Code: Select all
[<=0][RED]"ATTENTION, less than -50!!!";[>0][BLACK];General
Re: [Solved] Event triggers for text control?
Posted: Thu Nov 10, 2016 2:38 am
by owlbrudder
F3K Total wrote:The query gives back 0 or 1, and the field is formatted like this:
Code: Select all
[<=0][RED]"ATTENTION, less than -50!!!";[>0][BLACK];General
Yes, that is a good solution for a grid or list fed by a query rather than directly by a table.
I expect there are other ways to approach this as well, so I have some more study to do. Many thanks for taking the time to help.
Cheers,
Doug