Search by form: Yes / No / Both (1 Viewer)

RickDB

Registered User.
Local time
Today, 13:26
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!!!!
 

grnzbra

Registered User.
Local time
Today, 18:26
Joined
Dec 5, 2001
Messages
376
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.
 

CEH

Curtis
Local time
Today, 12:26
Joined
Oct 22, 2004
Messages
1,187
See if this gives you some ideas Rick
 

Attachments

  • combos.zip
    57.8 KB · Views: 293

Users who are viewing this thread

Top Bottom