Hi all,
I am currently working to set up a feature in my database that will allow users to look up doctors based on specific criteria such as "City", "State", "Zip", "Gender", "Age of Patient", etc...
I would like to create a "search form" that will open up a different "results" form based on entries in the search form. On my search form I have unbound text boxed and check boxes. I also have a button which would open the "results" form based on the criteria in the unbound controls. Kick is - I would like to be able to search by a combination of the boxes as well (i.e. search for a female doctor in denver that sees 1-6 year olds)
I have posted the code below that is the event procedure on the command button that only searches by city but I cant figure out how to make it search for any combination of the entries. As you might be able to tell, I'm not that good a code so any help would be greatly appreciated!
Thanks Much,
Andy
-----------------------------------------------------
Private Sub Command53_Click()
On Error GoTo Err_Command53_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPAPResultsForm"
stLinkCriteria = "[City]=" & "'" & Me![City] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command53_Click:
Exit Sub
Err_Command53_Click:
MsgBox Err.Description
Resume Exit_Command53_Click
End Sub
I am currently working to set up a feature in my database that will allow users to look up doctors based on specific criteria such as "City", "State", "Zip", "Gender", "Age of Patient", etc...
I would like to create a "search form" that will open up a different "results" form based on entries in the search form. On my search form I have unbound text boxed and check boxes. I also have a button which would open the "results" form based on the criteria in the unbound controls. Kick is - I would like to be able to search by a combination of the boxes as well (i.e. search for a female doctor in denver that sees 1-6 year olds)
I have posted the code below that is the event procedure on the command button that only searches by city but I cant figure out how to make it search for any combination of the entries. As you might be able to tell, I'm not that good a code so any help would be greatly appreciated!
Thanks Much,
Andy
-----------------------------------------------------
Private Sub Command53_Click()
On Error GoTo Err_Command53_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPAPResultsForm"
stLinkCriteria = "[City]=" & "'" & Me![City] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command53_Click:
Exit Sub
Err_Command53_Click:
MsgBox Err.Description
Resume Exit_Command53_Click
End Sub