Steven Pyrah
New member
- Local time
- Today, 16:17
- Joined
- Jan 11, 2003
- Messages
- 7
I have a button on my form that e-mails fields from that form. The code works fine, it picks up everything I need and mails it to everyone it should.
Problem is this, once the database has sent 1 record (1 e-mail) it will not run again when I create a new record. I have to close and repair the database before it will run again.
Can anyone see any holes in the code I have found and modified from this forum.
Private Sub Command51_Click()
Dim stMsg As String
Dim stBCC As String
Dim stTO As String
stTO = Me.[Mail1] & "; " & Me.[Mail2]
stCC = Me.[TL1] & "; " & Me.[TL2]
stMsg = "(" & Me.[First Applicant] & ")" & " has swapped this shift (" & Me.[First Applicants Shift] & ") and this lunch (" & Me.[1st App Lunch] & ") on this date (" & [Date Wanting To Swap] & ") with (" & Me.[Second Applicant] & ") and their shift of (" & Me.[Second Applicants Shift] & ") and lunch at (" & Me.[2nd App Lunch] & ") on this date (" & Me.[Date Wanting To Swap (Second)] & ")" & vbCrLf & vbCrLf & "NOTES" & vbCrLf & vbCrLf & Me.[Notes] & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "Please keep this e-mail safe as it is your proof that the shift swap has been authorised by (" & Me.[Authorised_By] & ")" & vbCrLf & "Thank You"
DoCmd.SendObject , , , stTO, stCC, stBCC, "Shift Swap Notification Produced By CCD", stMsg, False
End Sub
Any help would be great
Thanks
Problem is this, once the database has sent 1 record (1 e-mail) it will not run again when I create a new record. I have to close and repair the database before it will run again.
Can anyone see any holes in the code I have found and modified from this forum.
Private Sub Command51_Click()
Dim stMsg As String
Dim stBCC As String
Dim stTO As String
stTO = Me.[Mail1] & "; " & Me.[Mail2]
stCC = Me.[TL1] & "; " & Me.[TL2]
stMsg = "(" & Me.[First Applicant] & ")" & " has swapped this shift (" & Me.[First Applicants Shift] & ") and this lunch (" & Me.[1st App Lunch] & ") on this date (" & [Date Wanting To Swap] & ") with (" & Me.[Second Applicant] & ") and their shift of (" & Me.[Second Applicants Shift] & ") and lunch at (" & Me.[2nd App Lunch] & ") on this date (" & Me.[Date Wanting To Swap (Second)] & ")" & vbCrLf & vbCrLf & "NOTES" & vbCrLf & vbCrLf & Me.[Notes] & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "Please keep this e-mail safe as it is your proof that the shift swap has been authorised by (" & Me.[Authorised_By] & ")" & vbCrLf & "Thank You"
DoCmd.SendObject , , , stTO, stCC, stBCC, "Shift Swap Notification Produced By CCD", stMsg, False
End Sub
Any help would be great
Thanks