SELECT statement in UNBOUND text box

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I have linked a report to e.g. TABLE_1. Hence,
the "record source" for this report is TABLE_1.

However, in the same report I need to retrieve a field
from Table_2.

Hence, I have added another UNBOUND text box onto the
report.

Using the following SELECT statements did not work for me:

SELECT [COUNT].[TABLE_2]
=(SELECT [COUNT].[TABLE_2])


Does anyone know how to do this?


Thanks,
Tom
 
You cannot use an SQL statement in the control source of a textbox (or any
other control). Instead, use the DLookup function to find and return a value
from a table or query.

Use an expression similar to this in the textbox's control source:

=DLookup("FieldToFind", "Table_2")

If you need to use a filter criterion for this lookup, that goes into the
third argument:

=DLookup("FieldToFind", "Table_2", "[Field] = 'Some Value'")
 
Back
Top