Option Button, Option Value - files only with numeric value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I create an Option Group on a form, it seems I can only select a numeric
value in the Option Value which files to the table. When I create reports I
do not want to see a numeric value, I would rather see something more
descriptive - Yes or No rather than a -1 or 2.

How can I do this?
 
When I create an Option Group on a form, it seems I can only select a numeric
value in the Option Value which files to the table. When I create reports I
do not want to see a numeric value, I would rather see something more
descriptive - Yes or No rather than a -1 or 2.

How can I do this?

Several ways.
You store the numeric value of the option group in your table.
Let's say the Field name is Payment, and the Option Group had 3
buttons. The table field stores 1, 2, or 3.

In your report, you would use an unbound control.
=IIf([Payment]=1,"Credit Card",IIf([Payment] = 2,"Check",IIf([Payment]
= 3,"Cash")))

You could also use Choose.
=Choose([Payment],"Credit Card","Check","Cash")

Using VBA you could also use Select Case.
 
This seems to be the common MS "solution". This is a very poor design, in my
opinion. I have an Access front end sitting on SQL Server. They have a gender
field that is either "Male" or "Female". I was able to fix a similar problem
with check boxes by writing many lines of code to check values, etc. The
problem with Option Groups is that you cannot assign a value to show them has
selected. The database schema on SQL side is set in stone at this company,
seems option buttons are out, whatb a shame, now I will prbably have to
re-invent the wheel and write my own "option" butons.

fredg said:
When I create an Option Group on a form, it seems I can only select a numeric
value in the Option Value which files to the table. When I create reports I
do not want to see a numeric value, I would rather see something more
descriptive - Yes or No rather than a -1 or 2.

How can I do this?

Several ways.
You store the numeric value of the option group in your table.
Let's say the Field name is Payment, and the Option Group had 3
buttons. The table field stores 1, 2, or 3.

In your report, you would use an unbound control.
=IIf([Payment]=1,"Credit Card",IIf([Payment] = 2,"Check",IIf([Payment]
= 3,"Cash")))

You could also use Choose.
=Choose([Payment],"Credit Card","Check","Cash")

Using VBA you could also use Select Case.
 
Back
Top