Message Box Not Displaying

jfisher4

Registered User.
Local time
Yesterday, 23:18
Joined
Oct 29, 2002
Messages
13
I have a form to select a specific report to print. In the form the user first selects a patient from a list box and then a date from a combo box. If the user clicks the print button without selecting the patient or date, message boxes appear. My problem is if the user prints or previews the report, and then selects another patient, the message box for the date does not appear the second and subsequent times.

Private Sub PrintNsgRpt_Click()
If IsNull(Me![SelectPt]) Then
MsgBox "Please select patient."
End If
If IsNull(Me![SelectDate]) Then
MsgBox "Please select visit date."
Else
Dim WClause
WClause = "[ContactID]=" & [SelectPt]
DoCmd.OpenReport ReportName:="Nursing Report", _
WhereCondition:=WClause, View:=Me![PrintorPreview]

End If
End Sub

Hoping you can help.
 
I would assume that your [SelectPT] and [SelectDate] controls are unbound. That means that they will retain their values when you return from the report to the criteria form. If you would like to force them to re-enter a date after selecting a new patient, you could clear the [SelectDate] box after selecting a patient.

Private Sub SelectPT_AfterUpdate()
me.SelectDate=null
end sub
 
I previously had a "requery" on the date so that the correct choices show for subsequent patients. When I changed it to the new code only the dates for the initial patient appear in the list.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom