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

Error message with Calling Stored procedure with parameter

Status
Not open for further replies.

hedgracer

Programmer
Mar 21, 2001
186
US
I have the following VBA code:

Dim strMonth As String

strMonth = Me.cboOnyxAllocationHistoryMonth.Value


strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo_Onyx_Allocation_Report_Creation " & strMonth

MsgBox strSQL_Execute
cnxn.Execute strSQL_Execute, , adExecuteNoRecords

The parameter being passed in strMonth is "02/28/2010". When I run the stored procedure in SQL Server 2005 the procedure runs just fine. The error message I get is as follows:

Incorrect syntax near '/'.

This error message is coming from the following line:

cnxn.Execute strSQL_Execute, , adExecuteNoRecords

I have never run into this before and have googled this to death. Any help on this is greatly appreciated. Thanks.

Dave
 



Please post the string value in strSQL_Execute (your SQL).



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
The complete strSQL_Execute is as follows:

dbo_Onyx_Allocation_Report_Creation 02/28/2010
 


That is NOT your SQL!

Skip,

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

Part and Inventory Search

Sponsor

Back
Top