J
jackie
Dear Gurus:
I have an event procedure as follow:
Private Sub cmdEmail_Unmanaged_Click()
Dim dbs As Database, ic As Recordset
Dim strToWhom As String
Dim strMsgBody As String
Dim strQry As String
Set dbs = CurrentDb
strQry = "SELECT distinct EMAIL_ADDRESS FROM
TRIUMPH_FXF_SALESCONTEST_ENTRY where
EMPL_NBR=[forms]![frmlEmployeeNbr]![emp_no]"
Set ic = dbs.OpenRecordset(strQry, dbOpenForwardOnly)
While Not ic.EOF
strToWhom = ic![EMAIL_ADDRESS]
strMsgBody = "Please find attached file for the
information you recently_ entered for the FedEx Freight Sales Contest. This
entry failed the contest’s validation process for the following reason: ENTRY
IS NOT A MANAGED ACCOUNT. "
' Send query in excel format.
DoCmd.SendObject acSendQuery, "Validate_Acct_NonManaged_Send",
acSpreadsheetTypeExcel9, _
strToWhom, , , "Invalid Entry for Freight Sales Contest ", _
strMsgBody, False
ic.MoveNext
Wend
ic.Close
Set ic = Nothing
End Sub
The code stops at the openRecordset() and says "too few parameters, expected
1". What is this error? How can I get it work?
Thanks,
JC
I have an event procedure as follow:
Private Sub cmdEmail_Unmanaged_Click()
Dim dbs As Database, ic As Recordset
Dim strToWhom As String
Dim strMsgBody As String
Dim strQry As String
Set dbs = CurrentDb
strQry = "SELECT distinct EMAIL_ADDRESS FROM
TRIUMPH_FXF_SALESCONTEST_ENTRY where
EMPL_NBR=[forms]![frmlEmployeeNbr]![emp_no]"
Set ic = dbs.OpenRecordset(strQry, dbOpenForwardOnly)
While Not ic.EOF
strToWhom = ic![EMAIL_ADDRESS]
strMsgBody = "Please find attached file for the
information you recently_ entered for the FedEx Freight Sales Contest. This
entry failed the contest’s validation process for the following reason: ENTRY
IS NOT A MANAGED ACCOUNT. "
' Send query in excel format.
DoCmd.SendObject acSendQuery, "Validate_Acct_NonManaged_Send",
acSpreadsheetTypeExcel9, _
strToWhom, , , "Invalid Entry for Freight Sales Contest ", _
strMsgBody, False
ic.MoveNext
Wend
ic.Close
Set ic = Nothing
End Sub
The code stops at the openRecordset() and says "too few parameters, expected
1". What is this error? How can I get it work?
Thanks,
JC