I am a surgeon and has made a database for my patient record keeping. I have got a form 'Basic History Examination Form' that should not be opened directly but through another form "Patient Biodata Form". For that, I put following code in on exit event of 1st control of form 'HistoryID'
When I open the form directly and attempt to enter data, it responds with pre-defined msg correctly but when I close msgbox and try to close the form, msgbox appears again... when I close it for second time, it again re-appears and then on closing msgbox, it closes alongwith form....
In this code "PatientIDPicke r is an unbound field on form that gets automatically with 'patientID' value when form is opened in a normal way. e.g through Patient Biodata form.
I am unable to figure out that where there is a problem..
Is there anybody to help me out
Code:
Private Sub HistoryID_Exit(Cancel As Integer)
If IsNull(Me.PatientIDPicker) Then
MsgBox "Sorry...!" & vbCrLf & "You can not enter data directly into 'Basic History Examination Form'" & vbCrLf & "Please " & _
"close form and attempt data entry through 'Patient Biodata Form'", vbInformation, "Wrong Data Entry Attempt"
Form.DataEntry = False
Exit Sub
In this code "PatientIDPicke r is an unbound field on form that gets automatically with 'patientID' value when form is opened in a normal way. e.g through Patient Biodata form.
I am unable to figure out that where there is a problem..
Is there anybody to help me out
Comment