I new to working with SQL in Access macros, and have a problem with the following code.
When i run this, it returns an error msg that says "A RunSQL action requires an argument consisting of an SQL statement"
This is the associated query that runs fine.
Is there an obvious mistake I'm making?
Sub SQLtest()
Dim strSQL As String
strSQL = "SELECT AUTO_PREMTREND.[Fiscal_Year],AUTO_PREMTREN[CLEP],AUTO_PREMTREND.[Earned_Exp] " & _
"FROM AUTO_PREMTREND " & _
"WHERE AUTO_PREMTREND.[State_Cd]='AZ' " & _
"AND AUTO_PREMTREND.[Major_Peril_Cd]='BI'" & _
"ORDER BY AUTO_PREMTREND.[STATE_Cd];"
DoCmd.RunSQL strSQL
End Sub
When i run this, it returns an error msg that says "A RunSQL action requires an argument consisting of an SQL statement"
This is the associated query that runs fine.
SELECT AUTO_PREMTREND.Fiscal_Year, AUTO_PREMTREND.CLEP, AUTO_PREMTREND.Earned_Exp
FROM AUTO_PREMTREND
WHERE (((AUTO_PREMTREND.State_Cd)="AZ") AND ((AUTO_PREMTREND.Major_Peril_Cd)="bi"));
Is there an obvious mistake I'm making?