I
ID10Terror
Hi:
I am using Access 2003 along with Outlook 2003. I am sending Access records
to different users. The table has a field called "Ver_Sent". After the
record is emailed, mark the record "True / Yes" and go to the next record.
Everything works except that I can not mark the record. Can anyone help me
with this please.
Thank You
***** Code *****
Private Sub Command3_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheNumber1 As String
Dim TheNumber2 As String
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblVerified")
MyRS.MoveFirst
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
Do Until MyRS.EOF
' Create the email message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheNumber1 = MyRS![Ver_Subject]
TheNumber2 = MyRS![Ver_EmailAddy]
TheNumber3 = MyRS![Ver_Body]
With objOutlookMsg
' Add the To recipient to the email message.
Set objOutlookRecip = .Recipients.Add(TheNumber2)
objOutlookRecip.Type = olTo
' Set the Subject, Body and Importance of the email message.
.Subject = TheNumber1
.Body = TheNumber3
.Importance = olImportanceHigh 'High importance
' Add attachments to the email message.
' If Not IsMissing(AttachmentPath) Then
' Set obOutlookAttach = .Attachments.Add(AttachmentPath)
' End If
'Resolve each Recipients name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS![Ver_Sent] = "True"
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
I am using Access 2003 along with Outlook 2003. I am sending Access records
to different users. The table has a field called "Ver_Sent". After the
record is emailed, mark the record "True / Yes" and go to the next record.
Everything works except that I can not mark the record. Can anyone help me
with this please.
Thank You
***** Code *****
Private Sub Command3_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheNumber1 As String
Dim TheNumber2 As String
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblVerified")
MyRS.MoveFirst
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
Do Until MyRS.EOF
' Create the email message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheNumber1 = MyRS![Ver_Subject]
TheNumber2 = MyRS![Ver_EmailAddy]
TheNumber3 = MyRS![Ver_Body]
With objOutlookMsg
' Add the To recipient to the email message.
Set objOutlookRecip = .Recipients.Add(TheNumber2)
objOutlookRecip.Type = olTo
' Set the Subject, Body and Importance of the email message.
.Subject = TheNumber1
.Body = TheNumber3
.Importance = olImportanceHigh 'High importance
' Add attachments to the email message.
' If Not IsMissing(AttachmentPath) Then
' Set obOutlookAttach = .Attachments.Add(AttachmentPath)
' End If
'Resolve each Recipients name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS![Ver_Sent] = "True"
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub