Select statement to vba

Jake55923

New member
Local time
Yesterday, 20:15
Joined
Jan 30, 2004
Messages
9
I cannot figure out how to transfer this sequel statement into vba code. I know the syntax for the overall select statement, but the count portion is giving me trouble.

SELECT [tbl Safety].Department, [tbl Safety].Status, Count([tbl Safety].Status) AS CountOfStatus
FROM [tbl Safety]
GROUP BY [tbl Safety].Department
HAVING ((([tbl Safety].Status)="Completed" Or ([tbl Safety].Status)"Incomplete"));

Thanks in advance
Jake
 
I believe that you can only run "action" [update, append, delete] SQL in VBA, not a "select" SQL.
 
What do you mean translate SQL into VBA?

You have a syntax error in the last line of the SQL:
Or ([tbl Safety].Status)"Incomplete"));

Also, what other Status entries are possible besides Complete or Incomplete? Just wondering? I guess it could be Unknown.
 

Users who are viewing this thread

Back
Top Bottom