I cant run this. please help! the error is
run-time error 3061 too few parameters expected 1
in this line --------->> Set rs = db.OpenRecordse t <---- below
run-time error 3061 too few parameters expected 1
in this line --------->> Set rs = db.OpenRecordse t <---- below
Code:
Public Function SendEmailAdvice() As String
Dim db As DAO.Database, rs As DAO.Recordset
Dim sSQL As String
'Set environment
Set db = CurrentDb
DoCmd.SetWarnings False
'Open the controlling recordset
Set rs = db.OpenRecordset("qrySendEmailAdvice")
While Not rs.EOF
'For each record (Booking) send an email
'For each record (Booking) send an email
DoCmd.SendObject acSendNoObject, , , rs![Emails], "steveo@lifetimebrands.com; larryo@lifetimebrands.com; richo@lifetimebrands.com; baruc.estrada@lifetimebrands.com", , "Service Reminder " & rs![Type] & " # " & rs![Truck_ID], "Service for " & rs![Type] & " # " & rs![Truck_ID] & " has been scheduled for " & rs![Day] & " " & rs![Scheduled Date] & Chr$(13) & Chr$(13) & _
"This is a reminder." & Chr$(13) & Chr$(13) & _
"If you cannot send the truck down for service please let us know before 12 noon today."
'Update the SM table so that emails are not duplicated
sSQL = "UPDATE SM and PM Monthly Schedule SET EmailSent=-1 WHERE ID=" & rs![ID]
'Cycle on to the next record
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
'Control recordset now closed
'Reset environment
DoCmd.SetWarnings True
End Function
Comment