Query not working with Checkboxes

FaithSpins

New member
Local time
Today, 08:09
Joined
Dec 16, 2010
Messages
5
Hi there!

Me again...

I decided to work from scratch in an effort to learn this properly. Well, my efforts are futile!

What I am hoping to do is create a form with checkboxes that run a query based on the checkboxes ticked. More than one checkbox might be ticked. The query "should" spit out the company names that jive with the boxes checked.

What I have:

A table named Contacts. In there has all of the contact information (company, address, etc and so on) along with (5) check boxes that the end user checks if applicable. There are some records with just one checked box or some with several checked boxes.

anyway...

I have an unbound form named frmPortStat with checkboxes (cb1, cb2, cb3, cb4, cb5). They are "labled" the same as those checkboxes in the Contacts' table. This is where the end user would tick the boxes and then click a command button to run a query and produce those results in its subform.(Port_Stat_Results).

I have a query named qryPortStat. In this query sits [Company] and those five checkboxesfrom the Contacts Table. The query's criteria for all five checkbox controls are set to True (without quotes).

Next I placed a command button that would be used to run the query based on the boxes checked & behind it I placed the following code:

Option Compare Database

Private Sub Command13_Click()
Me.Port_Stat_Results.Requery


End Sub

I then view the form to test it but...parameter boxes in the name of each check box keeps coming up like annoying flies you can't reach with a swatter! And of course there are no results.

What am I missing?

I would great appreciate input.

thank you very very much!
 
...

I have a query named qryPortStat. In this query sits [Company] and those five checkboxesfrom the Contacts Table. The query's criteria for all five checkbox controls are set to True (without quotes).

...

If your True criteria for each check box are all on the same row (And criteria), then the query will only collect records in which all check boxes are checked (True).


If your True criteria for each check box are each on separate lines (Or criteria) your query will return any record in which any one or more of the check boxes is checked.
 
Thank you, Booty!

I see all records now (I didn't before). Also, great advise on the next line! It never occured to me.

However...I'm still getting those Enter Parameter boxes coming up. I can't run the query still. I didn't enter [Enter stuff here] in the criteria, either.

What is hiding that I need to look for?
 
However...I'm still getting those Enter Parameter boxes coming up. I can't run the query still. I didn't enter [Enter stuff here] in the criteria, either.

What is hiding that I need to look for?
Here are a couple of places you can look:

1. In the record source of the form, look for fields that don't exist or are like Expr1, for example.
2. In the control source of each control, look for field names that don't exist. Use the drop down to ensure that the field is highlighted which would indicate that it exists. For listboxes and combo boxes look in the Row Source property by viewing the query behind it.
3. In the Order By and Filter By properties of the form, check that the fields in there actually exist
 

Users who are viewing this thread

Back
Top Bottom