psx4u
04-20-2004, 06:00 AM
I have:
tblMain
frmFilter
rptMain
On the form I have 3 combo boxes and a command button.
The combo boxes all get their data from an SQL statement, e.g:
SELECT DISTINCT tblMain.Item1 FROM tblMain ORDER BY FullDetails.Item1;
SELECT DISTINCT tblMain.Item2 FROM tblMain ORDER BY FullDetails.Item2;
At the moment, when i click the command button it runs a piece of code to filter for what has been selected in the combo boxes.
However, something has to be selected in every combo box for this to work.
Ideally I need an option for 'All' in the combo boxes.
I have looked at various ways of doing this over google but I haven't found a solution that works.
The piece of code I am using to filter with is only very basic:
Function MainQuery_Preview()
DoCmd.OpenReport "rptMain", acViewPreview, "", "[tblMain]![Item1]=[Forms]![frmFilter]![Item1] And [tblMain]![Item2]=[Forms]![frmFilter]![Item2] And [tblMain]![Item3] = [Forms]![frmFilter]![Item3]", acNormal
End Function
Any help is gratefully appreciated.
Thanks
tblMain
frmFilter
rptMain
On the form I have 3 combo boxes and a command button.
The combo boxes all get their data from an SQL statement, e.g:
SELECT DISTINCT tblMain.Item1 FROM tblMain ORDER BY FullDetails.Item1;
SELECT DISTINCT tblMain.Item2 FROM tblMain ORDER BY FullDetails.Item2;
At the moment, when i click the command button it runs a piece of code to filter for what has been selected in the combo boxes.
However, something has to be selected in every combo box for this to work.
Ideally I need an option for 'All' in the combo boxes.
I have looked at various ways of doing this over google but I haven't found a solution that works.
The piece of code I am using to filter with is only very basic:
Function MainQuery_Preview()
DoCmd.OpenReport "rptMain", acViewPreview, "", "[tblMain]![Item1]=[Forms]![frmFilter]![Item1] And [tblMain]![Item2]=[Forms]![frmFilter]![Item2] And [tblMain]![Item3] = [Forms]![frmFilter]![Item3]", acNormal
End Function
Any help is gratefully appreciated.
Thanks