Yes/No Question

K

knowshowrosegrows

I think this is simple, but unfortunately - so am I.

I want a yes/no field but instead of the choices being Yes and No I want
them to be Active and Inactive. What am I missing under Help or in this
discussion group?
 
B

Beetle

You could create a combo box with the following properties

Control Source = [Yes/No field from your table or query]
Row Source = -1;Active;0;Inactive (make sure you make the first value
negative 1)
Bound Column = 1
Column Count = 2
Column Widths = 0",1"
Limit to List = Yes
 
J

Jeff Boyce

In a table, in a form, in a report, ...?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Spencer

You can set the format to display Acitve and Inactive for the field.

Format: ;"Active";"Inactive"

This works because Yes/No fields store -1 and Zero.
Number fields have four format options (positive, negative, zero, and null)


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
J

John W. Vinson

I think this is simple, but unfortunately - so am I.

I want a yes/no field but instead of the choices being Yes and No I want
them to be Active and Inactive. What am I missing under Help or in this
discussion group?

Are you talking about in a Table or on a Form? Note that Tables are not
designed (and not appropriate!) for viewing, entering or editing data; that
should all be done on a Form.

A Yes/No field is actually stored in the table as a number: Yes is -1, No is
0. If you wish the user to see Active and Inactive as choices, use a Form with
a Combo Box bound to the field. Set the combo box's Row Source Type property
to "Value List", Column Count to 2, Column Widths to 0";.75" (or some suitable
width, just so the first value is 0), Bound Column to 1, and Row Source to

-1;"Active";0;"Inactive"

This will store -1 or 0 but display the text.

John W. Vinson [MVP]
 
K

Ken Sheridan

Why not simply use a text field with a Validation Rule of:

In ("Active","Inactive")

For data entry via a form you can then use a combo box with a RowSourceType
of Value List and a RowSource of Active;Inactive. Leave the combo box's
ColumnCount and BoundColumn properties as the default of 1, and the
ColumnWidths property blank.

This avoids the reliance on the implementation of Boolean (Yes/No) values in
Access as -1 or 0 which a two-column combo box or formatting solution
requires. Reliance on the implementation ('being unduly chummy with the
implementation' as the head of one software company of my acquaintance once
called it) is not good programming practice and best avoided.

If a Boolean (Yes/No) data type is used then create a separate table with a
Boolean column and a Text column and rows:

True Active
False Inactive

You can the use a query on this table as the RowSource of a two-column (with
first column hidden) combo box on a form, the implementation now being
irrelevant, as it should be. In a report you'd join the tables on the
Boolean columns in the report's underlying query and return the text column
from the new table rather than the Boolean column from the current table.

Ken Sheridan
Stafford, England
 

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