storing results of a query into a variable

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

Guest

I need to store the results of a query into a variable in Access VBA, but i'm
having trouble with the function. This is a sample of the code

Dim x as integer

x = Docmd.openquery("select Query")

The query should return a number
Thanks
 
Take a look at DLookup function and use that instead:

Dim x As Integer
x = DLookup("FieldName", "table/query name")
 

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