I get run time error 3061
too few parameters expected 2. in the openrecordset line
Any suggestions?
Expand|Select|Wrap|Line Numbers
- Private Sub cmdGenerateEmail_Click()
- On Error GoTo err_cmdGenerateEmail_Click
- Dim strEMail As String
- Dim oOutlook As Object
- Dim oMail As Object
- Dim strAddr As String
- Dim MyDB As DAO.Database
- Dim rstEMail As DAO.Recordset
- Set oOutlook = CreateObject("Outlook.Application")
- Set oMail = oOutlook.CreateItem(0)
- 'Retrieve all E-Mail Addressess in qrySheduleEmail
- Set MyDB = CurrentDb
- Set rstEMail = MyDB.OpenRecordset("Select * From qryScheduleEmail", dbOpenSnapshot, dbOpenForwardOnly)
- With rstEMail
- Do While Not .EOF
- 'Build the Recipients String
- strEMail = strEMail & ![EmailAddress] & ";"
- .MoveNext
- Loop
- End With
- '--------------------------------------------------
- With oMail
- .To = Left$(strEMail, Len(strEMail) - 1) 'Remove Trailing ;
- .Body = InputBox("Please enter your email text here:")
- .Subject = InputBox("Please enter your Subject Line Here:")
- '.Send
- .Display
- End With
- Set oMail = Nothing
- Set oOutlook = Nothing
- rstEMail.Close
- Set rstEMail = Nothing
- End Sub