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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top