Printing a newrecord before update

NPUser

Registered User.
Local time
Yesterday, 20:07
Joined
Jul 25, 2004
Messages
55
Hi All,
I am having problem printing a label based upon newrecord. The report prints but has no information. I think it is because it is not save to the table yet since i have this event before update.

Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim stDocName As String
stDocName = "rpt_inv_Labels_OCTag"

If Me.NewRecord Then

Dim strNewMsg As String

strNewMsg = "New Inventory Detected" & vbCrLf & vbCrLf & vbCrLf
strNewMsg = strNewMsg & " 'YES' to Save, Print a Label and Close." & vbCrLf & vbCrLf
strNewMsg = strNewMsg & " 'NO' to Save but do not Print a Label and Close." & vbCrLf & vbCrLf
Beep
If MsgBox(strNewMsg, vbQuestion + vbYesNo, "Print Label?") = vbYes Then
' Save Record, Print Label and close

DoCmd.OpenReport stDocName, acNormal

Else
'do nothing means save
End If
Else
Dim strMsg As String

strMsg = "Data has changed." & vbCrLf & vbCrLf & vbCrLf
strMsg = strMsg & " 'YES' to Save, Print a Label and Close." & vbCrLf & vbCrLf
strMsg = strMsg & " 'NO' to Save but do not Print a Label and Close." & vbCrLf & vbCrLf
strMsg = strMsg & " 'Cancel' Undo changes and Close." & vbCrLf

Beep
Select Case MsgBox(strMsg, vbQuestion + vbYesNoCancel, "Save Record?")
Case vbCancel
DoCmd.RunCommand acCmdUndo

Case vbYes
' Save Record, Print Label and close

DoCmd.OpenReport stDocName, acNormal


Case vbNo
'do nothing means save and close

End Select
End If
End Sub


Report record source:
SELECT tbl_inv_detail.Inven_ID, tbl_inv_detail.OCTag, tbl_inv_detail.Inv_Status_change_dte FROM tbl_inv_detail WHERE (((tbl_inv_detail.Inven_ID)=[Forms]![frm_inv_inventory]![Inven_ID].[value]));

Inven_ID (PK) Datatype:Autonumber

Please help
 

Users who are viewing this thread

Back
Top Bottom