Replace Option Group Value from form with text in report header

G

Guest

Hi all,

Question: How can I convert the numerical option group value from a form to
a string value and place it in the control source of a textbox in a report
header?

I have a form used to 'build' reports: users choose a query, a report, and
then the rest of the controls on the form are used to build a 'where' clause
for the DoCmd.OpenReports statement attached to a command button which opens
the report based on all the user's choices.

I've tried creating a variable on the report in the declarations area and
then using a select case statement in the 'open' event of the report, but
that's too late to be used in the text box on my report I think. Maybe I
could just expand the code in the control source of the text box with
imbedded IIf statements, but the character limit is going to be a problem I
think.

Is there some better way? I remember when I created the option group there
was some opportunity to change the values of each option....could I change
the values to strings instead of the numbers that the wizard used? That will
surely mess up that part of my where statement on the form but I think I'd be
in better position to deal with that than I am this current problem.

Anyway, any help would be appreciated. If there's a way to accomplish this,
all I need is the broad strokes I think.

Thanks,
CW
 
A

Allen Browne

Create a table with 2 fields: one for the number (primary key), and one for
the matching name. Records will look like this:
1 dog
2 cat
3 fish

Now create a query with your existing table and the new one joined on the
number fields. You can now include the Text field, so show in your report.

We generally refer to this kind of table as a lookup.
 

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