Alternate for Checkboxes in Report

D

Dwayne Conyers

We have a table that has a number of "yes/no" values as checkboxes on a
form.

In the report I'm developing, I want to display only those items that are
checked (with a value of "yes").

Also, rather than display a checkbox, I'd like to display text/label
representing the name of the item.

For example, if we have three checkboxes, "scotch," "gin," and "vermouth"
and the record has "scotch" checked and the others unchecked, for that
record on the report I want to display the word "scotch" not the checkbox.

I've been hacking around with some code but would appreciate some tips to
expedite making this work.

TIA
 
D

Douglas J. Steele

Add a text box to the report and make its ControlSource equal to something
like:

=(IIf([Scotch], "Scotch", Null) + ", ") & (IIf([Gin], "Gin", Null) + ", ") &
IIf([Vermouth], "Vermouth", Null)

In actual fact, though, you'd probably be better off if you had a normalized
design, rather than a series of checkboxes like this.

In other words, you should have a table that contains the three rows Scotch,
Gin and Vermouth, and a resolution table that resolves the many-to-many
relationship between your Alcohol table and your existing table.
 
F

fredg

We have a table that has a number of "yes/no" values as checkboxes on a
form.

In the report I'm developing, I want to display only those items that are
checked (with a value of "yes").

Also, rather than display a checkbox, I'd like to display text/label
representing the name of the item.

For example, if we have three checkboxes, "scotch," "gin," and "vermouth"
and the record has "scotch" checked and the others unchecked, for that
record on the report I want to display the word "scotch" not the checkbox.

I've been hacking around with some code but would appreciate some tips to
expedite making this work.

TIA

Add an unbound control to the report.
Set it's control source to the check box field.
In the control's Format property, write:
;"Scotch";

Do the same for each of the other check box field's.

See Access help for
Format Property + Number and Currency datatypes.
 
D

Dwayne Conyers

Douglas J. Steele said:
Add a text box to the report and make its ControlSource equal to something
like:

=(IIf([Scotch], "Scotch", Null) + ", ") & (IIf([Gin], "Gin", Null) + ", ")
&
IIf([Vermouth], "Vermouth", Null)

In actual fact, though, you'd probably be better off if you had a
normalized
design, rather than a series of checkboxes like this.


Thought of that -- but the user interface (form) requires checkboxes and it
seemed convoluted to go 3NF for the 20 or so items they requested. Your
suggestion works great, though. Thanks!
 

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