G
Guest
I am developing a search facility for my db of patients. I have a form with
an unbound txtbox and unbound listbox. You enter the PatientID you're looking
for in the txtbox and as you type, the listbox displays the PatientID numbers
in the db (using a query as the RowSource). You can either enter all 6 digits
of the number and are left with one option in the listbox or after say 3
digits you see your required PatientID in the listbox. Double Clicking the
required entry in the listbox opens a different form with the rest of that
patients details for further editing. If the patient is not in the db, the
listbox will not display any data. This is where I get stuck with my next
step. If the list box is empty, ie: the patient is not in the db, I'd like
the patient detail form to open ready to enter the patient as a new record.
So, first I can trap the fact that the listbox is empty, does the listbox
have a property that I can use? Second can you code opening a form at a new
record page?
This code updates the listbox as the user types the PatientID in the textbox:
Screen.ActiveForm![lstSearch].RowSource = "qry_TEST_Filter"
DoCmd.Requery "lstSearch"
This is the code I'm trying to use to test if the listbox has actually got
any entries in it:
Private Sub lstSearch_AfterUpdate()
If Screen.ActiveForm![lstSearch].RowSource = "" Then
DoCmd.OpenForm "frmTEST", acNormal
End If
End Sub
Any suggestions would be most welcome,
TIA,
Ian.
an unbound txtbox and unbound listbox. You enter the PatientID you're looking
for in the txtbox and as you type, the listbox displays the PatientID numbers
in the db (using a query as the RowSource). You can either enter all 6 digits
of the number and are left with one option in the listbox or after say 3
digits you see your required PatientID in the listbox. Double Clicking the
required entry in the listbox opens a different form with the rest of that
patients details for further editing. If the patient is not in the db, the
listbox will not display any data. This is where I get stuck with my next
step. If the list box is empty, ie: the patient is not in the db, I'd like
the patient detail form to open ready to enter the patient as a new record.
So, first I can trap the fact that the listbox is empty, does the listbox
have a property that I can use? Second can you code opening a form at a new
record page?
This code updates the listbox as the user types the PatientID in the textbox:
Screen.ActiveForm![lstSearch].RowSource = "qry_TEST_Filter"
DoCmd.Requery "lstSearch"
This is the code I'm trying to use to test if the listbox has actually got
any entries in it:
Private Sub lstSearch_AfterUpdate()
If Screen.ActiveForm![lstSearch].RowSource = "" Then
DoCmd.OpenForm "frmTEST", acNormal
End If
End Sub
Any suggestions would be most welcome,
TIA,
Ian.