Hi all
I have a problem with a form i am building.
From an initial form (TitleForm) i want the user to be taken to a screen that lets them add a patients details if they don't already exist on the system. When the user adds a new patient the "patient details form" opens on a new record and allows the user to add details. This part works fine. The other part of the "TitleForm" is to be able to select an existing patient from a drop down list and once selected, a button appears to allow the user to select the patient. Its at this point the problems begin. i've written some code to that should determine if the drop down box has had a value selected. If so then the code takes the patient identifier of the selected patient and then should place it in the filter of the "patient details form" and display all the details for that patient. Only it doesn't
. I get an error message saying "You cancelled the previous operation"
Here's the code for onOpen event for the patient details form:
Private Sub Form_Open(Cancel As Integer)
Me.Refresh
'Check to see if a patient has been chosen from the select patient form
If Not IsNull(Forms!TitleForm.SelectPatient) Then
Dim num As String
Dim cbo As ComboBox
Set cbo = Forms!TitleForm.SelectPatient
num = cbo.Column(3)
Dim patCriteria As String
patCriteria = "PatUnitNo = '" & num & "'"
Me.Filter = patCriteria
Me.FilterOn = True
Else
DoCmd.GoToRecord , , acNewRec
End If
End Sub
Any help on what i may be doing wrong would be most appreciated
Thanks
I have a problem with a form i am building.
From an initial form (TitleForm) i want the user to be taken to a screen that lets them add a patients details if they don't already exist on the system. When the user adds a new patient the "patient details form" opens on a new record and allows the user to add details. This part works fine. The other part of the "TitleForm" is to be able to select an existing patient from a drop down list and once selected, a button appears to allow the user to select the patient. Its at this point the problems begin. i've written some code to that should determine if the drop down box has had a value selected. If so then the code takes the patient identifier of the selected patient and then should place it in the filter of the "patient details form" and display all the details for that patient. Only it doesn't
Here's the code for onOpen event for the patient details form:
Private Sub Form_Open(Cancel As Integer)
Me.Refresh
'Check to see if a patient has been chosen from the select patient form
If Not IsNull(Forms!TitleForm.SelectPatient) Then
Dim num As String
Dim cbo As ComboBox
Set cbo = Forms!TitleForm.SelectPatient
num = cbo.Column(3)
Dim patCriteria As String
patCriteria = "PatUnitNo = '" & num & "'"
Me.Filter = patCriteria
Me.FilterOn = True
Else
DoCmd.GoToRecord , , acNewRec
End If
End Sub
Any help on what i may be doing wrong would be most appreciated
Thanks