My application is a Access 2000 front end and SQL server backend. I have a stored procedure on the server that will accept 2 variables. From my Front End I have a form with 2 comboboxes that pass that data along. I have been successful at passing one variable, but 2 is giving me grief. Here is my module...
'Set up the DAO for the pass-through SQL query
Dim db As Database
Dim MyQueryDef As QueryDef
Dim SQLString As String
Dim SPTQueryName As String
Dim msg As String
Set db = CurrentDb()
db.QueryTimeout = 240
SPTQueryName = "qrySponsorReportByDivision_SQL"
If ObjectExists("Queries", SPTQueryName) = True Then
Set MyQueryDef = db.CreateQueryDef(SPTQueryName)
MyQueryDef.Connect = IMO_ODBCConnectionString
'Now is a good time to display the Project Manager Choice Selection Screen.
If intDivision = 0 Then
DoCmd.OpenForm "frmSponsorReportByDivision", acNormal, , , acFormEdit, acDialog
'Set the SQL property and concatenate the variables
If intDivision <> 0 Then
I NEED HELP HERE -----> SQLString = "upSponsorReportByDivision" & "'" & intDivision & "' '" & intSponsor & "'"
MyQueryDef.SQL = SQLString
MyQueryDef.ReturnsRecords = True
DoCmd.OpenQuery SPTQueryName, acViewNormal
MyQueryDef.ReturnsRecords = False
What am I doing wrong? I have tried to seperate those 2 variables with comma's and that didn't work either.