How to get the result of a query into a VB variable?

  • Thread starter Thread starter Randi W
  • Start date Start date
R

Randi W

Excuse me for my newbie question, but I am working on a form with some event
code, and I would like to put the result of a query into a variable, like
this:

Res = "select count(*) from tableQ"

How do I do that?

Thanks for your help!

Randi W.
 
Hi,


myVar =DCOUNT("*", "tableQ")


or, in general, using ADO, as example:


myVar = CurrentProject.Connection.Execute("SELECT COUNT(*) FROM
tableQ").Fields(0).Value




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top