Hi All!
I want to send email using the email address from a access table. I want that all fields againts that email address should be in email body. I tried to do that but the error coming
"Can't find the field '|' reffered to in your experession"
I using the following routine
***********************************************************
Private Sub Command202_Click()
On Error GoTo Err_Command202_Click
'Declaration of Variables
Dim email As String
Dim cc As String
Dim origin As String
Dim body As String
Dim dbs As DAO.Database
Dim rs1 As DAO.Recordset
'Open and populate the recordset with required data
Set dbs = CurrentDb
Set rs1 = dbs.OpenRecordset("Select * FROM [PO Master]WHERE [PO No]= " & [PO No].Value)
'Gather the information about the e-mail
email = rs1("Email")
'Set up the body of the e-mail to add all fields
body = [PO No]
'Send the e-mail to the recipients
DoCmd.SendObject acSendForm, , acFormatTXT, email, cc, , "Your PO ", body, True
'Add a new record
DoCmd.GoToRecord , , acNewRec
Exit_Command202_Click:
Exit Sub
Err_Command202_Click:
MsgBox Err.Description
Resume Exit_Command202_Click
End Sub
***********************************************************
If anybody can help me out. I'll be thankful.
I want to send email using the email address from a access table. I want that all fields againts that email address should be in email body. I tried to do that but the error coming
"Can't find the field '|' reffered to in your experession"
I using the following routine
***********************************************************
Private Sub Command202_Click()
On Error GoTo Err_Command202_Click
'Declaration of Variables
Dim email As String
Dim cc As String
Dim origin As String
Dim body As String
Dim dbs As DAO.Database
Dim rs1 As DAO.Recordset
'Open and populate the recordset with required data
Set dbs = CurrentDb
Set rs1 = dbs.OpenRecordset("Select * FROM [PO Master]WHERE [PO No]= " & [PO No].Value)
'Gather the information about the e-mail
email = rs1("Email")
'Set up the body of the e-mail to add all fields
body = [PO No]
'Send the e-mail to the recipients
DoCmd.SendObject acSendForm, , acFormatTXT, email, cc, , "Your PO ", body, True
'Add a new record
DoCmd.GoToRecord , , acNewRec
Exit_Command202_Click:
Exit Sub
Err_Command202_Click:
MsgBox Err.Description
Resume Exit_Command202_Click
End Sub
***********************************************************
If anybody can help me out. I'll be thankful.