View Single Post
Old April 5th, 2004, 05:23 PM
lxu lxu is offline
Authorized User
Join Date: Oct 2003
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to execute SELECT count(*)

Please help and here is the code:

Dim db As DAO.Database
Dim strSQLSel As String


strSQLSel = "SELECT Count(*) AS Expr1 FROM TBL-1 WHERE (((TBL-1.[COLUMN-1])='" & var-1 & "') AND ((TBL-1.[COLUMN-2]) Is Not Null)) OR (((TBL-1.[COLUMN-2)='" & var-1 & "'))"

Set db = CurrentDb
db.Execute (strSQLSel)

The error message is "Cannot execute a select query"
If I should not use db.Execute, what should I use here to get the number of count?

Thanks in advance,