B
benforum via AccessMonster.com
I am trying to send a report using an email address in a DB. I wrote the
following code for it.
Private Sub Reminder_Letter_Command_Click()
On Error GoTo Err_Reminder_Letter_Command_Click
Dim stDocName As String
Dim SendTO As String
stDocName = "BG Reminder Letter"
RunQuery
MsgBox "This is After RunQuery " & SendTO
SendTO = [Queries]![BG email only from email from ae code].EmailAddress
MsgBox "This is SendTO 2 Value ==== " & SendTO
DoCmd.OpenReport stDocName, acViewNormal
DoCmd.SendObject acSendReport, stDocName, , SendTO
Exit_Reminder_Letter_Command_Click:
Exit Sub
Err_Reminder_Letter_Command_Click:
MsgBox Err.Description
Resume Exit_Reminder_Letter_Command_Click
End Sub
The query runs and produces the correct email address, however when I try to
put it into a string I receive an error message. The email field is defined
in the DB as text.
What am I doing wrong? How to correct the code?
following code for it.
Private Sub Reminder_Letter_Command_Click()
On Error GoTo Err_Reminder_Letter_Command_Click
Dim stDocName As String
Dim SendTO As String
stDocName = "BG Reminder Letter"
RunQuery
MsgBox "This is After RunQuery " & SendTO
SendTO = [Queries]![BG email only from email from ae code].EmailAddress
MsgBox "This is SendTO 2 Value ==== " & SendTO
DoCmd.OpenReport stDocName, acViewNormal
DoCmd.SendObject acSendReport, stDocName, , SendTO
Exit_Reminder_Letter_Command_Click:
Exit Sub
Err_Reminder_Letter_Command_Click:
MsgBox Err.Description
Resume Exit_Reminder_Letter_Command_Click
End Sub
The query runs and produces the correct email address, however when I try to
put it into a string I receive an error message. The email field is defined
in the DB as text.
What am I doing wrong? How to correct the code?