Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Query

Status
Not open for further replies.

rich001

Programmer
Feb 24, 2006
9
US
I am writing a query with 6 tables being included in it. All tables are check boxes except for the key. Is there an easy way to count all columns in the tables and display all records that = yes with out defining "yes" in each field?
 
I'm a little confused at what you want from the column count, it sounds like you want to know how many columns there are in each table? or how many columns are checked?

Check boxes store either NULL (No entry), 0 (False, no, or not Check), and -1 (True, yes, or Checked). To create criteria for checkboxes that are 'yes' use -1
Code:
WHERE  ((tbl_MyTable.MyCheckBox1)=-1))

-Chris
Starlight B. M.
 
I am trying to count the number of columns in one query and select all records with a (-1) in all columns.
 
I am puzzling over your number of columns. I'm womdering if something like this might do:
Code:
Dim ColumnSize as Integer
ColumnSize = Len(qryMyQuery)
Just a guess there.

In Query Design Mode, enter -1 on the Criteria line for the first criteria. On the Or line for the rest of the columns, enter -1 for all other columns. That should select any row that has a column with a -1.

Hope that helps, and if not, share with us where this data is going (how it's shown in the form) and maybe that will help guide to an answer.

-Chris
Starlight B. M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top