SendObject bug in Access2000?

B

Beejels

I'm trying to send e-mail based on an address that is listed in a query. Each
record has specific information and the e-mail address that it should go to.
I've used a While loop in combination with the SendObject, to send the
specific information to each recipient.

It bombs as soon as the e-mail name changes, although I can see that the
name has changed using the debugger. I get error 2501, The send object was
cancelled.

The code is below. this worked in Access 97; it no longer works in 2000,
making me think there is a bug in the "newer" software.

Any advice? Thanks in advance.

Function MailAR()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Accounts Receivable") 'this is a table
rst.MoveFirst
Delete all old data
While rst.EOF = False
rst.Delete
rst.MoveNext
Wend
'bring in new data from spreadsheet
DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel2000, "Accounts
Receivable", "artest2.xls", _
True, "A:C"
Set rst = CurrentDb.OpenRecordset("AR email") 'This is the query that
links the data to an e-mail address from a table
rst.MoveFirst
'send email to each employee with data in the spreadsheet
While rst.EOF = False
DoCmd.SendObject acSendNoObject, , , rst.Fields("ename"), , ,
"Accounts Receivable", _
"The project '" & rst.Fields("CUSTOMER") & "' has an overdue AR.
You are listed as the PM of this " _
& "project." & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
"Please report what action you are taking to collect this AR in
column K of the spreadsheet at" _
& Chr(13) & Chr(10) & Chr(13) & Chr(10) & "artest2.xls" _
& Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Messages for AR's are
sent automatically on a weekly basis." _
& "Please see Kristin if you feel you have received this message
in error.", False
rst.MoveNext
Wend
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top