Link to home
Start Free TrialLog in
Avatar of Joe
JoeFlag for Canada

asked on

Translate option group values to text in a report

I have a report that is built based on a query
The report format is mandated by a higher headquarters and must contain specific data.

My db has a field called Report_Type which has 3 options, 1, 2 , and 3
those types need to be translated on the report to a check box:
Initial (1)
Follow-up (2)
Final (3)

How can I translate or convert a single character text field to the coresponding check box?
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Create this Expression in your query:

RptType: Choose([Report_Type],"Initial","Follow-Up","Final")

mx
Opps ... so, you mean 3 check boxes on the Report ?
Not quite following ..
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Since Option Groups are generally mutually exclusive ..... ?

mx
You're right mx, I was thinking of 3 separate checkboxes.  Using a bound option group would make the most sense.
Well ... that's the confusion ... actually. Maybe OP really has 3 check boxes in a 'group' ... not clear.

mx
Try this: using a form, modify if otherwise.

"My db has a field called Report_Type which has 3 options, 1, 2 , and 3"
Change optControl with Report_Type, and (replace with your text) as required


Option Group: optControl, its label: optControlLabel, caption: opt Control Caption

options:
opt1, option value 1,       label: opt1Label, caption: opt 1 caption
opt1, option value 2        label: opt2Label, caption: opt 2 caption
opt1, option value 3,       label: opt3Label, caption: opt 3 caption

Private Sub Command7_Click() 
    Dim result As String
    result = Switch(optControl = optControl.Controls(1).OptionValue, optControl.Controls(2).Caption _
                , optControl = optControl.Controls(3).OptionValue, optControl.Controls(4).Caption _
                , optControl = optControl.Controls(5).OptionValue, optControl.Controls(6).Caption)
    Debug.Print result & "(" & optControl & ")"
End Sub

' one result opt 3 Label(3)

Open in new window


To try it with your existing option group, you need to change names of option group name, and options names only. The code will display the relevant existing caption and the option value.
Avatar of Joe

ASKER

Worked like a charm. Thank You!