johnny130553 said:
Hoy Rick,
The RecordSource property of my report is refering to a certain query. Now,
in this same report I have a TextBox where I like to shown data which is not
included in this query. The requested data is a selection in a Field of a
different Table (in the same dBase). How can I build up my expression in the
TextBox ControlSource to show that TableField selection?
Regards.
Agree with Rob. Use Dlookup() or if there is a natural relationship add the
other table to the query currently being used as the RecordSource.
If the latter is not practical and the TextBox you are referring to will be
repeated many times in the report (not in a header/footer), then a custom
function could perform better as DLookup() is inefficient when called over and
over in succession. This is largely because it is instantiating objects and
refreshing collections with each call. A custom function could avoid this
overhead by using objects that are created once at report open and destroyed
when the report is closed.
Personally, I would start with DLookup() and see how it performs. (KISS
principle).