text box control source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What kind of expression do I have to write down in a text box control source
to make a selection of records from a table field?
I can not use the "Record source" as it is allready occupied by another query.

Thanks in advance
 
johnny130553 said:
What kind of expression do I have to write down in a text box control source
to make a selection of records from a table field?
I can not use the "Record source" as it is allready occupied by another query.

Well I'm confused because a TextBox doesn't have a RecordSource property and I
don't know what you mean when you say "...make a selection of records from a
table field".

A Form or Report has a RecordSource which would ordinarily be the name of a
table, query, or a SQL String. A TextBox has a ControlSource which is normally
an expression or the name of a Field found in the Form/Report RecordSource.
 
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.
 
dlookup is your friend!

Or you could add the additional data to your report's recordsource by
changing the query.

Rob
 
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).
 
Back
Top