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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL characters at the end of the statement 1

Status
Not open for further replies.

Brogrim

Technical User
Jul 28, 2000
184
IE
I have written the following SQL statemenbt when I try to execute I get a message

"Characters found after end of SQL statement"

The statement is

Function test()
On Error GoTo test_Err

DoCmd.RunSQL "SELECT tblStaffMon3.StaffID, tblStaffMon3.MonthID, tblStaffMon3.SupportServicesID, tblStaffMon3.Details, tblStaffMon3.Numbers INTO tblSM FROM tblStaffMon3 WHERE (((tblStaffMon3.MonthID) Between [Forms]![frmReportStaffMon]![cboMonth1ID] And Forms!frmReportStaffMon!cboMonth2ID));, -1"


test_Exit:
Exit Function

test_Err:
MsgBox Error$
Resume test_Exit

End Function

Thanks in advance
 
Try:
Code:
DoCmd.RunSQL "SELECT tblStaffMon3.StaffID, tblStaffMon3.MonthID, tblStaffMon3.SupportServicesID, tblStaffMon3.Details, tblStaffMon3.Numbers INTO tblSM  FROM tblStaffMon3  WHERE (((tblStaffMon3.MonthID) Between [Forms]![frmReportStaffMon]![cboMonth1ID] And Forms!frmReportStaffMon!cboMonth2ID));", -1




[pc2]
 
I have included another parameter and it give's a complie error.

DoCmd.RunSQL "SELECT tblStaffMon3.StaffID, tblStaffMon3.MonthID, tblStaffMon3.SupportServicesID, tblStaffMon3.Details, tblStaffMon3.Numbers INTO tblSM" From tblStaffMon3 WHERE (((tblStaffMon3.StaffID)=[Forms]![frmReportStaffMon]![cboFSWID]) AND ((tblStaffMon3.MonthID) Between [Forms]![frmReportStaffMon]![cboMonth1ID] And [Forms]![frmReportStaffMon]![cboMonth2ID]));", -1

Thanks again, I am trying
 
You may try this:
DoCmd.RunSQL "SELECT StaffID, MonthID, SupportServicesID, Details, Numbers INTO tblSM" _
& " FROM tblStaffMon3 WHERE StaffID=[Forms]![frmReportStaffMon]![cboFSWID] AND (MonthID Between [Forms]![frmReportStaffMon]![cboMonth1ID] And [Forms]![frmReportStaffMon]![cboMonth2ID]);", -1


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top