Writing SQL in VBA

LaBam

Registered User.
Local time
Today, 13:06
Joined
Mar 21, 2002
Messages
48
I'm trying to write a query in VBA to sum and count salaries and persons based on dates on a form. But I keep getting SYNTAX ERROR. Could someone please help me write this in the correct form it should be.

Here is my code:

Code:
Set rstOutGoingMin = "Select AllNames, Sum(Salary) As TotalSalary, Count(AllNames) As TotalCount From REVENUE " _
    & "Where StartDate >= '" & [Forms]![frmRevenue]![txtBegin] & "'  " And StartDate <= '" & [Forms]![frmRevenue]![txtEnd] & "'" & "GROUP BY AllNames ; "
 
Sorry I posted this thread twice. It was not intentional. My Internet connection was not too good.
 
Sorry I posted this thread twice. It was not intentional. My Internet connection was not too good.
 
Sorry I posted this thread twice. It was not intentional. My Internet connection was not too good.
 
Try using:

Set rstOutGoingMinutes = CurrentDb.Openrecordset(SQL, Mode)
 

Users who are viewing this thread

Back
Top Bottom