Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with VBA Syntax needed

Status
Not open for further replies.

penndro

Technical User
Jan 9, 2005
108
0
0
US
I am trying to run a procedure to print my reports but I am getting a Runtime error 3141 - The Select Statement includes a reserved word or argument name that is misspelled or missing, or the punctuation is incorrect. Here is my code:

Code:
Public Sub RunReports()

Dim strRptFilter As String

Dim rst As Recordset

Set rst = CurrentDb.OpenRecordset("SELECT qry_EmployeeData_1.EEID, qry_EmployeeData_1.Emp_Name,FROM qry_EmployeeData_1,WHERE (((qry_EmployeeData_1.[Plan ID])=[Forms]![frm_PrintStatements]![cboPlanSelect]));", dbOpenSnapshot)

Do While Not rst.EOF
     strRptFilter = "[eeid] = " & Chr(34) & rst![EEID] & Chr(34)

    DoCmd.OutputTo acOutputReport, "2013 Incentive Statement Template", acFormatPDF, "C:\desktop\test" & "\" & rst![Emp_Name] & ".pdf"
    DoEvents
    rst.MoveNext
Loop

rst.Close
Set rst = Nothing
End Sub

any help would be appreciated
 
At a minimum there is a comma before the where clause.
 
...and a comma before the FROM Clause!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top