Help with Emailing out of Access

DiveKennene

Registered User.
Local time
Today, 01:55
Joined
May 8, 2008
Messages
18
Hello All,
I am in some serious need of help! I have created a database where I store customers info, including email address and date they became a customer. I have a form set up to run a query for sending out an email reminder to them. The problem is, the VB code will send out the email to the first recipient, but when it goes to loop through the recordset created by the query, I get the dreaded 2498 error. Here is the code I have on my form:

Private Sub Form_Load()

Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Dim Email As Variant

Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("Repack Reminder Query")


Do While Not rs.EOF
DoCmd.SendObject , , , rs.Fields("Email"), , , "Subject", "Message", False

rs.MoveNext
Loop
rs.Close
Set rs = Nothing



End Sub

What is wrong with this picture? Any help is GREATLY appreciated.
Thank you,
Matt
 
Simple Software Solutions

Change

Do While Not rs.EOF

to

Do Until rs.EOF


CodeMaster::cool:
 
Should be simple

Thank you for the advice...I tried that, but I still get the error message "Run Time error '2498' Wrong data type for one of the arguments. Any other suggestions?
 
Simple Software Solutions

What are you actullly sending? According to access you need to specify what type of object you are sending in your first argument

vis
DoCmd.SendObject acQuery, "ATTENTION", "MS-DOSText(*.txt)", rs("EmailAddress"), "","", "Subject", "Message", False, ""

David
 
Email

Hello,
I am sending a reminder email, no attachments or anything, to email addresses that are the result of a query ("Repack Reminder Query").
 
1. Get rid of

Dim Email As Variant

You don't need it.

2. instead of using rs("EmailAddress") as the argument, assign it to a string variable first - sometimes it doesn't like getting arguments like that, even though it really should accept them.
 
Oh, and get rid of the

,""

at the end of the argument list. You don't supply missing arguments, you just leave them off.
 

Users who are viewing this thread

Back
Top Bottom