CrystalSurfer
Matrix activist
- Local time
- Yesterday, 19:53
- Joined
- Jan 11, 2006
- Messages
- 75
I have a listbox on a form displaying records which can be filtered via a number of comboboxes.
These comboboxes allow the user to select "<ALL>" or a specific value from the list. It all works perfectly.
However, I would like to be able to select a filter value of "Null" on one of the comboboxes which would display those records without a value in the relevant field.
How can I do this?
The following (simplified) code is what I'm using:
SQL for the results listbox:
SQL code for the combobox filter:
VB Code in Combobox Search Function:
For those that have noticed I have a "Or is null" criteria on the AccountManager field in the result set. I want to take this out and allow the value "Null" to be selected on specifically.
Thanks.
These comboboxes allow the user to select "<ALL>" or a specific value from the list. It all works perfectly.
However, I would like to be able to select a filter value of "Null" on one of the comboboxes which would display those records without a value in the relevant field.
How can I do this?
The following (simplified) code is what I'm using:
SQL for the results listbox:
Code:
SELECT qryClientSearch.ID, qryClientSearch.Name, qryClientSearch.AccountManager, qryClientSearch.AccountMgr
FROM qryClientSearch
WHERE
(
((qryClientSearch.ID) Like fCboSearch([Forms]![frmClientSearch]![cboSearchName]))
AND
((qryClientSearch.AccountManager) Like fCboSearch([Forms]![frmClientSearch]![cboSearchAccountMgr]) Or (qryClientSearch.AccountManager) Is Null)
)
ORDER BY qryClientSearch.Name;
SQL code for the combobox filter:
Code:
SELECT qryStaff_All.ID, qryStaff_All.Nickname FROM qryStaff_All
UNION
(SELECT "*" AS ID,"<ALL>" AS Nickname FROM qryStaff_All)
ORDER BY qryStaff_All.Nickname;
VB Code in Combobox Search Function:
Code:
Public Function fCboSearch(vCboSearch As Variant)
If IsNull(vCboSearch) Or vCboSearch = "" Then
fCboSearch = "*"
Else
fCboSearch = vCboSearch
End If
End Function
For those that have noticed I have a "Or is null" criteria on the AccountManager field in the result set. I want to take this out and allow the value "Null" to be selected on specifically.
Thanks.