Groundrush
Registered User.
- Local time
- Today, 05:24
- Joined
- Apr 14, 2002
- Messages
- 1,376
I have a command button that when clicked on, attaches a doc to an email.
The problem is that it only works once, nothing happens when you click on it again. You have to close the database down then go back into the main form.
any ideas?
see my code below.
Private Sub cmdEmailJob_Click()
DoCmd.SendObject acReport, "rptVinciInstructionToEngageSubCon", "RichTextFormat(*.rtf)", EMail, , , SubjectLine, _
"Please see attached document.", False
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblSubConOrders SET tblSubConOrders.MailSent = -1 WHERE (((tblSubConOrders.MailSent)=0))"
DoCmd.OpenQuery "qryEmailSent", acNormal, acEdit
DoCmd.SetWarnings True
Forms!frmSubConOrders.Refresh
DoCmd.GoToControl "JobNo"
DoCmd.GoToRecord , "", acNewRec
End Sub
Cheers
The problem is that it only works once, nothing happens when you click on it again. You have to close the database down then go back into the main form.
any ideas?
see my code below.
Private Sub cmdEmailJob_Click()
DoCmd.SendObject acReport, "rptVinciInstructionToEngageSubCon", "RichTextFormat(*.rtf)", EMail, , , SubjectLine, _
"Please see attached document.", False
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblSubConOrders SET tblSubConOrders.MailSent = -1 WHERE (((tblSubConOrders.MailSent)=0))"
DoCmd.OpenQuery "qryEmailSent", acNormal, acEdit
DoCmd.SetWarnings True
Forms!frmSubConOrders.Refresh
DoCmd.GoToControl "JobNo"
DoCmd.GoToRecord , "", acNewRec
End Sub
Cheers