Query /sql question

  • Thread starter Thread starter Reidar
  • Start date Start date
R

Reidar

I have a query that counts number of records with a certain Where-condition
like

SQL1 = _
"SELECT Count(tblUtleieLokal.UtleieID) AS AntallUtleieID " & _
"FROM tblUtleieLokal " & _
"WHERE tblUt.........

DoCmd.RunSQL SQL1

I need to get the value of AntallUtleieID into a variable.
How do I do that?

reidarT
 
Use

Just use the dsum function

myvariable = dsum("column to sum", "table to sum", "where conditions")

So, in your example, we have

myvariable = dsum("UtleieID","tblUtleieLokal"," where...")

note that you do NOT include the word "where" in the above sql condition
part....
 

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