Yes/No Field in query

G

Guest

I feel really dumb that I can't get this to work, but here goes!
A dialog box filters a report by way of a query. The underlying table has a
yes/no field which I need to include in the filter. For some reason, no
matter what I do, it returns all records instead of "yes" or "no". I'm
obviously doing something wrong with the values in the dialog box (the query
would automatically pick up the values from the table, wouldn't it?), but
I've tried yes/no and -1/0 in check boxes, option boxes, etc. Nothing seems
to work! What I would really like to do is have a combo box with three
choices - yes, no, yes & no. Any help would be greatly appreciated!
 
G

Guest

I figured out what I was doing wrong, so I'm halfway there! Do you have any
idea what I could add as a third option that would show all records? both
those marked "yes" and those marked "no"?
 
J

James

like *


Claire said:
I figured out what I was doing wrong, so I'm halfway there! Do you have
any
idea what I could add as a third option that would show all records? both
those marked "yes" and those marked "no"?
 
J

John Vinson

I feel really dumb that I can't get this to work, but here goes!
A dialog box filters a report by way of a query. The underlying table has a
yes/no field which I need to include in the filter. For some reason, no
matter what I do, it returns all records instead of "yes" or "no". I'm
obviously doing something wrong with the values in the dialog box (the query
would automatically pick up the values from the table, wouldn't it?), but
I've tried yes/no and -1/0 in check boxes, option boxes, etc. Nothing seems
to work! What I would really like to do is have a combo box with three
choices - yes, no, yes & no. Any help would be greatly appreciated!

You can actually do this with a combo if you wish; set up a combo with
the following properties:

Name cboYesNo
RowSourceType Value List
RowSource -1;"Yes";0;"No";1;"All Records"
ColumnCount 2
ColumnWidths 0;.5"
BoundColumn 1

On the Query criteria line put

=[Forms]![YourFormName]![cboYesNo] OR
[Forms]![YourFormName]![cboYesNo] = 1


John W. Vinson[MVP]
 
G

Guest

It works perfectly! I can't thank you enough!

John Vinson said:
I feel really dumb that I can't get this to work, but here goes!
A dialog box filters a report by way of a query. The underlying table has a
yes/no field which I need to include in the filter. For some reason, no
matter what I do, it returns all records instead of "yes" or "no". I'm
obviously doing something wrong with the values in the dialog box (the query
would automatically pick up the values from the table, wouldn't it?), but
I've tried yes/no and -1/0 in check boxes, option boxes, etc. Nothing seems
to work! What I would really like to do is have a combo box with three
choices - yes, no, yes & no. Any help would be greatly appreciated!

You can actually do this with a combo if you wish; set up a combo with
the following properties:

Name cboYesNo
RowSourceType Value List
RowSource -1;"Yes";0;"No";1;"All Records"
ColumnCount 2
ColumnWidths 0;.5"
BoundColumn 1

On the Query criteria line put

=[Forms]![YourFormName]![cboYesNo] OR
[Forms]![YourFormName]![cboYesNo] = 1


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top