Refresh Command

Novice1

Registered User.
Local time
Today, 13:02
Joined
Mar 9, 2004
Messages
385
I have this code which I placed on a command button that automatically generates an e-mail. It works great! There are times however when I change my mind and decide not to send the e-mail so I close out the e-mail message without sending it.

The problem is I cannot send another e-mail using the button (current record or subsequent records) unless I close out the form then reopen it.

I suspect I didn't write some type of trap in the code but I'm not smart enough to figure it out. Any help would be appreciated.

==================================

Code

Private Sub MbrEMail_Enter()

If IsNull(Me![Unit]) Then

MsgBox "You must enter the member's unit", vbQuestion, "Member's Unit"

Else
If IsNull(Me![FName]) Then

MsgBox "You must enter the customer's first name", vbQuestion, "Member's First Name"

Else

If IsNull(Me![LName]) Then

MsgBox "You must enter the customer's last name", vbQuestion, "Member's Last Name"

Else

DoCmd.SendObject acSendNoObject, , acFormatTXT, Me.Email, Me.CSS_EMail & "; Randy.grubb@moody.af.mil", , "Personnel Data Discrepancy" & " - " & Me.Grade & " " & Me.LName, Me.Grade & " " & Me.LName & "," & _
vbCr & vbCr & "We recently noted the following Personnel data discrepancy. Please fix this discrepancy within the next 5 duty days." & vbCr & vbCr & _
" Finding: " & Me.Finding & vbCr & vbCr & _
" Necessary Correction: " & Me.NecessaryCorrection & vbCr & vbCr & _
"Note: We are monitoring this discrepancy until it is closed; therefore, if you're unable to correct " & _
"this issue within the next 5 duty days please drop me an e-mail identifying the circumstances (e.g., TDY, leave, etc.). Thank you for your assistance in this matter." & vbCr & vbCr & "vr" & vbCr & vbCr & vbCr & _
"Mr. James J. Petersen" & vbCr & "MPF Site Manager, Moody AFB" & vbCr & _
"Congressional Consulting Group, LLC" & vbCr & vbCr & "Comm (229) 257-3415, DSN 460-3415" & vbCr & "Fax (229) 257-3475", True

ActionTaken = ActionTaken & Format(Now, "dd mmm yy") & ": " & "E-mailed " & Me.Grade & " " & Me.LName & " this date to fix the discrepancy within five duty days"

DoCmd.GoToControl "LName"

End If
End If
End If
 
This is what I use

Hi

This is the code I use on a cmd button, I cancel and it works okay.

Private Sub cmdEmail_Click()
Dim Contact1emailaddress As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
email = Me!Contact1emailaddress
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = email
.Display
End With
Set objEmail = Nothing
Exit Sub
End Sub
 
Limited Knowledge

I have limited coding knowledge. I couldn't figure out the response to apply it to my situation. Any other help would be appreciated.
 
Code

The code works from a cmd button called cmdEmail
 

Users who are viewing this thread

Back
Top Bottom