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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Query

Status
Not open for further replies.

ddmtn546

Technical User
Dec 20, 2000
38
US
Being a novice, I am trying to use a query to calculate when ColumnA & ColumnB are both true:

Rec ColumnA ColumnB ColumnC (result)
1 0 0 0 (if A=1 & B=1 then C=1)
2 1 0 0 (if A=1 & B=1 then C=1)
3 0 1 0 (if A=1 & B=1 then C=1)
4 1 1 1 (if A=1 & B=1 then C=1)

I tried, in the query:
count_ColC=true: IIf([ColumnA] & [ColumnB]=1,1,0)

Am I on the right track or is there an easier method. Thanks in advance.
 
Goodday!
Why sure there's an easy method! Try this:

In your queries design view you have your columns as above.
In the first "criteria" row just below ColumnA type in:
True
And do it again right next to that (below ColumnB):
True

What you're saying here is show me only the records in the query whos ColumnA value is True AND ColumnB value is True.

Just like that!


Gord
ghubbell@total.net
 
Ghubbell, I appreciate your response,

Your tip does the trick, however, I now want to count the number of positive responses to the query so that I may just show that total number on a summary form instead of the query itself. Thanx.
 
Hit the "Totals" button on the tool bar (Sigma symbol)
and leave your criteria as it is but change each of your 2 columns "Totals row "Group by" to "Count". You'll have to remove the Rec column or you'll get a count of 1 in each record...Should work! Gord
ghubbell@total.net
 
Thanks Gord, now I can move off dead-center. Thanks for your time and help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top