J
James
I'm attempting to pass the input of a textbox from an Access form as a
parameter for a SQL procedure, however, I'm missing something very elementary
and I can't find it either through MSDN or Google and would please like some
assistance. I originally thought it was a quotes issue but that doesn't seem
to be the case since I can hardcode any given number in between the quotes
(i.e. "'1017QT'") and the code works fine.
=================================
Private Sub btn_spSQL_MailMerge_Click()
On Error GoTo Err_btn_spSQL_MailMerge_Click
Dim strSQL As String
Dim strSQL2 As String
Dim strSQL3 As String
Dim strLeaseNumber As String
strSQL = "EXEC QDBSQL.dbo.spMailMerge " 'note the extra space to
separate the parameter
strSQL2 = "EXEC QDBSQL.dbo.spSQLDataImport"
strSQL3 = "EXEC QDBSQL.dbo.Reporting"
strLeaseNumber = "'Forms!frmLeaseWorksheet.txtReportFilter'"
DoCmd.RunSQL strSQL & strLeaseNumber
DoCmd.RunSQL strSQL2
DoCmd.RunSQL strSQL3
DoCmd.Close
Exit_btn_spSQL_MailMerge_Click:
Exit Sub
Err_btn_spSQL_MailMerge_Click:
MsgBox Err.Description
Resume Exit_btn_spSQL_MailMerge_Click
End Sub
=================================
Now ultimately in MSSQL this is what the above code is supposed to
accomplish to better give you an idea of what I'm trying to accomplish:
EXEC QDBSQL.dbo.spMailMerge "1017QT"
EXEC QDBSQL.dbo.spSQLDataImport
EXEC QDBSQL.dbo.Reporting
Thank you for your assistance!
James
parameter for a SQL procedure, however, I'm missing something very elementary
and I can't find it either through MSDN or Google and would please like some
assistance. I originally thought it was a quotes issue but that doesn't seem
to be the case since I can hardcode any given number in between the quotes
(i.e. "'1017QT'") and the code works fine.
=================================
Private Sub btn_spSQL_MailMerge_Click()
On Error GoTo Err_btn_spSQL_MailMerge_Click
Dim strSQL As String
Dim strSQL2 As String
Dim strSQL3 As String
Dim strLeaseNumber As String
strSQL = "EXEC QDBSQL.dbo.spMailMerge " 'note the extra space to
separate the parameter
strSQL2 = "EXEC QDBSQL.dbo.spSQLDataImport"
strSQL3 = "EXEC QDBSQL.dbo.Reporting"
strLeaseNumber = "'Forms!frmLeaseWorksheet.txtReportFilter'"
DoCmd.RunSQL strSQL & strLeaseNumber
DoCmd.RunSQL strSQL2
DoCmd.RunSQL strSQL3
DoCmd.Close
Exit_btn_spSQL_MailMerge_Click:
Exit Sub
Err_btn_spSQL_MailMerge_Click:
MsgBox Err.Description
Resume Exit_btn_spSQL_MailMerge_Click
End Sub
=================================
Now ultimately in MSSQL this is what the above code is supposed to
accomplish to better give you an idea of what I'm trying to accomplish:
EXEC QDBSQL.dbo.spMailMerge "1017QT"
EXEC QDBSQL.dbo.spSQLDataImport
EXEC QDBSQL.dbo.Reporting
Thank you for your assistance!
James