Dear All,
It’s been many months since I was last on the forum. I was wondering if I can get some help and education with regards to coding a search form.
The database is a patient database used for tracking Inpatient data and Handover (or Handoffs for those in the US). It has been merrily ticking over since December and has accrued several thousand records. To get access to this data in new and interesting ways I’m trying evolve my rudimentary search function which currently only works for diagnosis, name and consultant (in otherword text fields).
Thus I have an unbound form that has various input boxes on it.
I have borrowed some code to power the form and have replaced with own fields:
ISSUE 1:
I am struggling with the date search function. It doesn't work. I would be grateful if someone could point out what is wrong with the code? I would also like for users to be able to search for a discharged date - though I'd be grateful here if you could comment on whether it is prudent to search for either a admitted date or a discharged date?
ISSUE 2:
I have a check box for "complications" that I'd like to be included on in the search. Could someone suggest the code that I would use?
Thanks in advance for your kind help! Happy to clarify any issues.
It’s been many months since I was last on the forum. I was wondering if I can get some help and education with regards to coding a search form.
The database is a patient database used for tracking Inpatient data and Handover (or Handoffs for those in the US). It has been merrily ticking over since December and has accrued several thousand records. To get access to this data in new and interesting ways I’m trying evolve my rudimentary search function which currently only works for diagnosis, name and consultant (in otherword text fields).
Thus I have an unbound form that has various input boxes on it.
I have borrowed some code to power the form and have replaced with own fields:
Code:
Dim criteria As String
‘ Looks for input text and adds it to the final criteria to power the search list at the end based on field in this case txtDiagnosis
If Not IsNull(Me.txtDiagnosis) Then
If criteria <> "" Then criteria – criteria & " and "
criteria = criteria & "txtDiagnosis like " & Chr(34) & "*" & Me.txtDiagnosis & "*" & Chr(34)
End If
'Searches for records that fall between specified date values (dtmStart and dtmStop) for when a patient was admitted (dtmAdmittedDate) [[[CURRENTLY NON FUNCTIONAL]]]
If Not IsNull(Me.dtmStart) Then
If IsNull(Me.dtmStop) Then
Me.dtmStop = Me.dtmStart
End If
If criteria <> "" Then criteria – criteria & " and "
criteria = criteria & "(dtmAdmittedDate >=#" & Me.dtmStart & “# and dtmAdmittedDate <=#” & Me.dtmStop & “#)””
End If
'Closes current form and then opens a List form (frm_InpatientList) based on the criteria in the search form.
DoCmd.Close acDefault
DoCmd.OpenForm “frm_InpatientList”, , , criteria, acDialog
ISSUE 1:
I am struggling with the date search function. It doesn't work. I would be grateful if someone could point out what is wrong with the code? I would also like for users to be able to search for a discharged date - though I'd be grateful here if you could comment on whether it is prudent to search for either a admitted date or a discharged date?
ISSUE 2:
I have a check box for "complications" that I'd like to be included on in the search. Could someone suggest the code that I would use?
Thanks in advance for your kind help! Happy to clarify any issues.