Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - Record needs to be printed before being sent! 1

Status
Not open for further replies.

jlancton

MIS
Jul 26, 2001
82
US
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
 
Jeff

Does the form still have the pencil icon at the side (indicating that it is in edit mode when you click the button)? If so, this can be easily fixed by putting

DoCmd.RunCommand acCmdSaveRecord

before the
stWhere = "NotifyID = " & Me.NotifyID

line, which forces Access to save the record.

John
 
Yes, the pencil was there, and that solved the problem.

Thank you so much!!!

-Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top