Setting Unbound Text Box to Query Result

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

Guest

Hi,
I have a form (frmObNew) that is bound to a table.
On the form I have a text box (ObTransNo) that I want to populate with one
of the output fields (MaxTransNo) from a query (qryMaxTransNo).
I can't figure out how to call this query.
I have tried various combinations in the Control Source and Default Value
properties, but haven't been able to figure it out.
TIA for your suggestions.
 
Hi,
I have a form (frmObNew) that is bound to a table.
On the form I have a text box (ObTransNo) that I want to populate with one
of the output fields (MaxTransNo) from a query (qryMaxTransNo).
I can't figure out how to call this query.
I have tried various combinations in the Control Source and Default Value
properties, but haven't been able to figure it out.
TIA for your suggestions.

Does that query return just one record (one row)?
If so:
=DLookUp("[FieldName]","QueryName")

If it returns many records you need to add a Where clause to the
DLookUp to restrict the value returned to just the one record you
want.
Look up DLookUp() in VBA Help, as well as
Where Clause + Restrict data to a subset of records
 
Thanks, Fred.
Just what I needed.
--
Ken Hudson


fredg said:
Hi,
I have a form (frmObNew) that is bound to a table.
On the form I have a text box (ObTransNo) that I want to populate with one
of the output fields (MaxTransNo) from a query (qryMaxTransNo).
I can't figure out how to call this query.
I have tried various combinations in the Control Source and Default Value
properties, but haven't been able to figure it out.
TIA for your suggestions.

Does that query return just one record (one row)?
If so:
=DLookUp("[FieldName]","QueryName")

If it returns many records you need to add a Where clause to the
DLookUp to restrict the value returned to just the one record you
want.
Look up DLookUp() in VBA Help, as well as
Where Clause + Restrict data to a subset of records
 
Back
Top