I am continually getting an error with some pretty basic code. The error is "error 3061 too few parameters expected 1" which normally means there's a problem with the SQL. The code is below:
Private Sub Command11_Click()
On Error GoTo Err_Handler
Dim strReport As String
Dim strMailTo As String
Dim strFileName As String
Dim strBrand As String
Dim strSQL As String
Dim rs As DAO.Recordset
Dim db As DAO.Database
strBrand = Me.Combo2
strReport = "rptEMailCatalog"
strFileName = "U:\" & strBrand & " New Releases.pdf"
''DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, strFileName
strSQL = "SELECT qryEMailTo.Email FROM qryEMailTo;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
Exit_Handler:
Exit Sub
Err_Handler:
If Err.Number <> 2501 Then
MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdPreview_Click"
End If
Resume Exit_Handler
End Sub
Any help would be greatly appreciated.
John Green
Private Sub Command11_Click()
On Error GoTo Err_Handler
Dim strReport As String
Dim strMailTo As String
Dim strFileName As String
Dim strBrand As String
Dim strSQL As String
Dim rs As DAO.Recordset
Dim db As DAO.Database
strBrand = Me.Combo2
strReport = "rptEMailCatalog"
strFileName = "U:\" & strBrand & " New Releases.pdf"
''DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, strFileName
strSQL = "SELECT qryEMailTo.Email FROM qryEMailTo;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
Exit_Handler:
Exit Sub
Err_Handler:
If Err.Number <> 2501 Then
MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdPreview_Click"
End If
Resume Exit_Handler
End Sub
Any help would be greatly appreciated.
John Green