Using check boxes to select criteria to run query
Rather than checkboxes I would use an Option Group set to display checkboxes.
Only one can be selected at a time but you can include one to show all.
When using the Option Group create a table --
tblCountry --
Num Country
1 Canada
2 UK
3 USA
4 France
5 Germany
6 All
In the query WHERE --
WHERE YourTable.Country = tblCountry.Country AND [Forms]![YourForm]![Frame0]
= tblCountry.NUM
For checkboxes --
In the query WHERE --
WHERE YourTable.Country = IIF([Forms]![YourForm]![CBO1] = -1, "Canada", "")
OR YourTable.Country = IIF([Forms]![YourForm]![CBO2] = -1, "UK", "") OR
YourTable.Country = IIF([Forms]![YourForm]![CBO3] = -1, "USA", "") OR
YourTable.Country = IIF([Forms]![YourForm]![CBO4] = -1, "France", "") OR
YourTable.Country = IIF([Forms]![YourForm]![CBO5] = -1, "Germany", "")
--
Build a little, test a little.
"Natalie" wrote:
I need some help. I have 5 check boxes. There is one for each country of
Canada
UK
USA
France
Germany
And i want the users to be able to tick which countries they wish to view
data for. The data is in a table with a column for country.
Please help as I am stuck.
Many Many thank you.
Natalie
|