Opening a Report

rnutts

Registered User.
Local time
Today, 14:22
Joined
Jun 26, 2007
Messages
110
Hi

I wish to add a command button which on the click event does the following

1 Saves the current record
2 Prompts the user with the question " Do you which to print lab sheet for this batch"
3 If the user selects Ok then the report "Lab Sheet" runs, if they select cancel I wish to close the form.

I have got as far as detailed below but am struggling now


Private Sub Samplescompleteforbatch_Click()


Me.Dirty = False
RetValue = MsgBox("Print Lab Sheet for this Batch?", vbOKCancel)
If RetValue = vbOK Then
DoCmd.OpenReport [Lab_Sheet], acViewPreview

End If

End Sub
 
Hi there

you're on the right path but I think your syntax needs tweaking ...


Code:
Me.Dirty = False
RetValue = MsgBox("Print Lab Sheet for this Batch?", vbOKCancel)
If RetValue = vbOK Then
DoCmd.OpenReport "lab_sheet", acViewPreview

End If

good luck
 

Users who are viewing this thread

Back
Top Bottom