Option Group Absurdity (1 Viewer)

Peter Paul

Registered User.
Local time
Today, 20:18
Joined
Jan 1, 2000
Messages
82
Ok, let me try to explain:

I have a field, Offense_Status which needs to have either A - Attempted or C - Completed put into it. I would like to have option buttons for the choice. The book I am using says that I can have the option button enter A or C for true or false, but I cannot get that to work.

So, I decided on a simple workaround. On Got Focus on the first option button I input

If True Then Offense_Status = "A"
(and on the second button)
If True Then Offense_Status = "C"

This works. But, if someone goes back into the form to revise or to look at it, neither of the buttons is true.

So, on the Open event for the Form, I tried

Iif Offense_Status = "A", Option91 = True, Option93 = True

I tried a miriad of options here, but have not gotten it to work. I am assuming that there is a simple way to make this happen, and that I am just missing it.

As always, thank you in advance for your assistance,
Peter Paul
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:18
Joined
Feb 19, 2002
Messages
43,602
The easiest thing to do is to use numeric values in the table for attempted and completed. Then in a report you can "decode" these values.

To actually store the letters rather than numbers you'll need to base your test on the option group and do it in the OnCurrent event and in the AfterUpdate event of the optonGroup.
 

Peter Paul

Registered User.
Local time
Today, 20:18
Joined
Jan 1, 2000
Messages
82
Pat,
thanks for the help. So if I understand you, best to just store the data as is, 0 or -1 etc., and to translate it when I need it.

I just ordered a new Access book with VBA, so hopefully I won't need to trouble you too much more on these things. But, until then....

So where would I make the translation? Directly on the field in the report? In a query?

I can guess my way through the code:

Iif(Offense_Status = 1, "Attempted", "Completed")

or something as such?

Thanks again,
Peter
 

llkhoutx

Registered User.
Local time
Today, 14:18
Joined
Feb 26, 2001
Messages
4,018
It seems to me that the field holding the offense status is not bound to the table which is the recordsource for your form.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:18
Joined
Feb 19, 2002
Messages
43,602
The Choose() function is an easy way to "decode" a small list of sequential values. Decoding in either the query or the control works.

Select Choose(YourFld, "val1", "val2", "val3") AS YourFldVal
From YourTable;

or as the control source for a control:
=Choose(YourFld, "val1", "val2", "val3")
 

Users who are viewing this thread

Top Bottom