Hello,
I have a db tracking Notifications. Each record is created using a form, which has two buttons, Send and Print. The problem is, if I open the form in Add mode to add a new notification record, and do NOT print it, using the Print button, before clicking the Send button, the resulting sent form is blank. If you print the form, then send, it works fine. I have posted my code below. If anyone has any ideas as to how to resolve this I would greatly appreciate it.
Thanks,
-Jeff
Private Sub Send_Form_Click()
On Error GoTo Err_Send_Form_Click
Dim stDocName As String
Dim stMsgTo As String
Dim stMsgBerk As String
Dim stSubject As String
Dim stWhere As String
Dim stIncMsg As String
Dim stIncTitle As String
stWhere = "NotifyID = " & Me.NotifyID
stDocName = "Copy of frm_NotifyForm"
stMsgTo = "yourname@somecompany.com"
stSubject = "Notification Attached - "
stIncMsg = "Form Not Complete, Please Check Entries"
stIncTitle = "Verification Check"
If Me.NotificationType = "0" Then
MsgBox stIncMsg, vbOKOnly, stIncTitle
Exit Sub
ElseIf Me.MRNUM = "0" Then
MsgBox stIncMsg, vbOKOnly, stIncTitle
Exit Sub
End If
MsgBox "Record is " & Me.NotifyID, vbOKOnly, stIncTitle
DoCmd.OpenReport stDocName, acViewPreview, , stWhere, acWindowNormal
DoCmd.SendObject acReport, stDocName, acFormatSNP, stMsgTo, , , stSubject & Me.ResidentName & ", " & Me.MRNUM, , 0
DoCmd.Close acReport, stDocName, acSaveNo
DoCmd.Close acDefault
Exit_Send_Form_Click:
Exit Sub
Err_Send_Form_Click:
MsgBox Err.Description
Resume Exit_Send_Form_Click
End Sub
Private Sub Print_Notification_Click()
On Error GoTo Err_Print_Notification_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
Exit_Print_Notification_Click:
Exit Sub
Err_Print_Notification_Click:
MsgBox Err.Description
Resume Exit_Print_Notification_Click
End Sub
I have a db tracking Notifications. Each record is created using a form, which has two buttons, Send and Print. The problem is, if I open the form in Add mode to add a new notification record, and do NOT print it, using the Print button, before clicking the Send button, the resulting sent form is blank. If you print the form, then send, it works fine. I have posted my code below. If anyone has any ideas as to how to resolve this I would greatly appreciate it.
Thanks,
-Jeff
Private Sub Send_Form_Click()
On Error GoTo Err_Send_Form_Click
Dim stDocName As String
Dim stMsgTo As String
Dim stMsgBerk As String
Dim stSubject As String
Dim stWhere As String
Dim stIncMsg As String
Dim stIncTitle As String
stWhere = "NotifyID = " & Me.NotifyID
stDocName = "Copy of frm_NotifyForm"
stMsgTo = "yourname@somecompany.com"
stSubject = "Notification Attached - "
stIncMsg = "Form Not Complete, Please Check Entries"
stIncTitle = "Verification Check"
If Me.NotificationType = "0" Then
MsgBox stIncMsg, vbOKOnly, stIncTitle
Exit Sub
ElseIf Me.MRNUM = "0" Then
MsgBox stIncMsg, vbOKOnly, stIncTitle
Exit Sub
End If
MsgBox "Record is " & Me.NotifyID, vbOKOnly, stIncTitle
DoCmd.OpenReport stDocName, acViewPreview, , stWhere, acWindowNormal
DoCmd.SendObject acReport, stDocName, acFormatSNP, stMsgTo, , , stSubject & Me.ResidentName & ", " & Me.MRNUM, , 0
DoCmd.Close acReport, stDocName, acSaveNo
DoCmd.Close acDefault
Exit_Send_Form_Click:
Exit Sub
Err_Send_Form_Click:
MsgBox Err.Description
Resume Exit_Send_Form_Click
End Sub
Private Sub Print_Notification_Click()
On Error GoTo Err_Print_Notification_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
Exit_Print_Notification_Click:
Exit Sub
Err_Print_Notification_Click:
MsgBox Err.Description
Resume Exit_Print_Notification_Click
End Sub