September 21st, 2012, 02:33 PM
[RESOLVED] Run-time Error 2498
I am working on some code that will send an e-mail through Outlook 2003 "On Click" of a button inside of a form in my 2003 Access db. The code was in a different database, and was working just fine, but now that I have moved it into the new db, I am having problems. I have checked and changed form names several times, so I am sure that the error has nothing to do with that. It is throwing the flag on the line that actually sends the e-mail.
The e-mail sends just fine, and even includes the form I want as an attachment, but keep getting an error message titled "Run-time Error 2498" once VB runs through the code. As far as functionality goes, there is no problem, but this is certainly annoying, and would like for it to stop.
Any help is greatly appreciated.
Option Compare Database
' Chad Jackson
' 5-Day E-Mail Notification
' This program finds all tickets that have been out for 5 days or longer,
' and then sends an e-mail to a pre-defined list of people.
' The purpose of this program is to help ensure a 5-day ticket turnaround time.
Private Sub btnSendEmail_Click()
Dim rs As DAO.Recordset
Dim stDocName As String
Dim StrAttach As String
Set rs = CurrentDb.OpenRecordset("5-Day E-Mail Addresses")
If .EOF And .BOF Then ' If there are no records, the message from the next line will display.
MsgBox " No emails will be sent because there are no records from the query '5 Day Ticket Notification' "
Do Until .EOF ' Do until the end of the recordset
' The next line sends the E-Mail
DoCmd.SendObject acSendForm, "5 Day Ticket Notification", , ![E-Mail Address], , , "5-Day Reminder!", "Hello " & ![First Name] & ", " & Chr(10) & "You have tickets that have been out for 5 days or longer. Please get them processed as soon as possible.", False
.MoveNext ' Moves to the next record in the recordset
' Memory Clean Up
If Not rs Is Nothing Then
Set rs = Nothing
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!