How do you display results of query in textbox

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

Guest

How do you display the results in a textbox from a query in an exit event of
a previous textbox?
 
How do you display the results in a textbox from a query in an exit event of
a previous textbox?

Use a DLookUp.

If the query returns just one record:
[ControlName]=DLookUp("[FieldName]","QueryName")

If the query returns more than one record....
If [Somefield] is a Number datatype, use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] = " &
SomeNumberCriteria)

If [SomeField] is Text datatype use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] ='" &
SomeTextCriteria & "'")

In VBA help, look up DLookUp
as well as
Where clause + Restrict data to a subset of records.
 
This worked beautifully ! ! ! Many thanks ! !



fredg said:
How do you display the results in a textbox from a query in an exit event of
a previous textbox?

Use a DLookUp.

If the query returns just one record:
[ControlName]=DLookUp("[FieldName]","QueryName")

If the query returns more than one record....
If [Somefield] is a Number datatype, use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] = " &
SomeNumberCriteria)

If [SomeField] is Text datatype use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] ='" &
SomeTextCriteria & "'")

In VBA help, look up DLookUp
as well as
Where clause + Restrict data to a subset of records.
 
fredg said:
How do you display the results in a textbox from a query in an exit event
of
a previous textbox?

Use a DLookUp.

If the query returns just one record:
[ControlName]=DLookUp("[FieldName]","QueryName")

If the query returns more than one record....
If [Somefield] is a Number datatype, use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] = " &
SomeNumberCriteria)

If [SomeField] is Text datatype use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] ='" &
SomeTextCriteria & "'")

In VBA help, look up DLookUp
as well as
Where clause + Restrict data to a subset of records.
 
krharrison said:
This worked beautifully ! ! ! Many thanks ! !



fredg said:
How do you display the results in a textbox from a query in an exit
event of
a previous textbox?

Use a DLookUp.

If the query returns just one record:
[ControlName]=DLookUp("[FieldName]","QueryName")

If the query returns more than one record....
If [Somefield] is a Number datatype, use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] = " &
SomeNumberCriteria)

If [SomeField] is Text datatype use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] ='" &
SomeTextCriteria & "'")

In VBA help, look up DLookUp
as well as
Where clause + Restrict data to a subset of records.
 
krharrison said:
This worked beautifully ! ! ! Many thanks ! !



fredg said:
How do you display the results in a textbox from a query in an exit
event of
a previous textbox?

Use a DLookUp.

If the query returns just one record:
[ControlName]=DLookUp("[FieldName]","QueryName")

If the query returns more than one record....
If [Somefield] is a Number datatype, use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] = " &
SomeNumberCriteria)

If [SomeField] is Text datatype use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] ='" &
SomeTextCriteria & "'")

In VBA help, look up DLookUp
as well as
Where clause + Restrict data to a subset of records.
 
fredg said:
How do you display the results in a textbox from a query in an exit event
of
a previous textbox?

Use a DLookUp.

If the query returns just one record:
[ControlName]=DLookUp("[FieldName]","QueryName")

If the query returns more than one record....
If [Somefield] is a Number datatype, use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] = " &
SomeNumberCriteria)

If [SomeField] is Text datatype use:
[ControlName]=DLookUp("[FieldName]","QueryName","[SomeField] ='" &
SomeTextCriteria & "'")

In VBA help, look up DLookUp
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