Search by form: Yes / No / Both

RickDB

Registered User.
Local time
Today, 04:34
Joined
Jun 29, 2006
Messages
101
Hello,

Considering the search function will not allow searching for 'yes' 'no' '0' or '-1' because they are too short, I have to ask here:

1st Question:
If providing query criteria by form, how do I set a query to show all records if the search/criteria source is null? This relates directly to the Yes/No problem, if I provide a checkbox to search for items sold, for example, it will only show items sold when clicked, if it is not clicked, it returns zero results.

Is this better handle by an option group on the form? Say Yes (value is -1), No (value is 0), and Both (value Is Null?). If someone could give me direction in both this specific issue, as well as how to best handle Is Null in a search query by form I oul REALLY appreciate it!!!


2nd Question:
How do you set up queries / forms to handle this?

Thank you!!!!
 
If you create a function with an input parameter for the value coming from a public variable.
You would then set the criteria "Like Function()". In the OnChange event for the checkbox, set the public variable to the value of the checkbox.

The function would be something like

Public Function(Public Variable) as String

If IsNull(PublicVariable) or PublicVariable = 0 Then
Function = "*"
Else
Function = "Sold"
End If
End Functtion

You might need some code to blow out the public variable between uses.
 
See if this gives you some ideas Rick
 

Attachments

Users who are viewing this thread

Back
Top Bottom