How to pass a value to a variable

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

Guest

I have a query that gets a value from a table. How do I pass that value to a
variable?
 
I have a query that gets a value from a table. How do I pass that value to a
variable?

With DLookUp:

variable = DLookUp("[fieldname]", "[queryname]")

This assumes that you're only interested in one field from the query,
and that the query returns only one record; DLookUp will return the
first value that it finds if the query has multiple records.

John W. Vinson[MVP]
 
Thanks John!

John Vinson said:
I have a query that gets a value from a table. How do I pass that value to a
variable?

With DLookUp:

variable = DLookUp("[fieldname]", "[queryname]")

This assumes that you're only interested in one field from the query,
and that the query returns only one record; DLookUp will return the
first value that it finds if the query has multiple records.

John W. Vinson[MVP]
 
Back
Top