Printing Option Group Literals on Report

S

Scott A

I would like to do something really cool on a report, but
am not sure how to accomplish it...

I'm dealing with data that is entered using an option
group with three options. Option 1 and Option 2 relate to
literal values, but Option 3 is "Other" and directs the
user to enter comments into a comment field.

Here's where I need some help:

Firstly, all I'm getting on my report are the values
stored in the database for each of the options in the
group (the numbers 1, 2, or 3). How do I make it so the
control on the report displays the literal values that
these numbers represent???

Secondly, it would be really cool that if the value were
3, that I could display the comment field instead of or in
addition to the literal. Any ideas???

Thanks!

Scott
 
W

Wayne Morgan

You appear to be using a textbox. If so, instead of using the field as the Control Source
of the textbox, use an equation.

Example:
=IIf([Field]=1, "First Value", IIf([Field]=2, "Second Value", "Other"))

You could place another textbox on the report that is bound to the comment field. In the
OnFormat event of the Detail section you could set the Visible property of this textbox.

If Nz(Me.txtComment, "") = "" Then
Me.txtComment.Visible = False
Else
Me.txtComment.Visible = True
End If
 
S

Scott A

I think that covers what I want to do with values 1 and
2...

As for the third value ("Other"), I'm wondering if
something a little tricker will work - if you would be so
kind as to look this over, I would love a second opinion:

If [Field]= 3 Then
Me.txtComment.Visible = True
Else
Me.txtComment.Visible = False
End If

My reason for wanting to do this is that there will only
be comments relevant to the report if the option selected
for the other field is 3.

Unfortunately, I don't have much experience writing VBA,
so if there's anything I've left out, please let me know.

Thanks for taking a look at this question for me.

Scott

-----Original Message-----
You appear to be using a textbox. If so, instead of using
the field as the Control Source
of the textbox, use an equation.

Example:
=IIf([Field]=1, "First Value", IIf([Field]=2, "Second Value", "Other"))

You could place another textbox on the report that is
bound to the comment field. In the
OnFormat event of the Detail section you could set the
Visible property of this textbox.
 
S

Scott A

I also have no idea as to why I'm returning a syntax error
with the following expression:

=IIf([InvoiceLabelLocation]=1, "On Equipment", IIf
([InvoiceLabelLocation]=2, "In Documentation"))


InvoiceLabelLocation is one of the fields returned by the
query upon which the report is based, and contains the
values stored by the option group on the form...

-----Original Message-----
I think that covers what I want to do with values 1 and
2...

As for the third value ("Other"), I'm wondering if
something a little tricker will work - if you would be so
kind as to look this over, I would love a second opinion:

If [Field]= 3 Then
Me.txtComment.Visible = True
Else
Me.txtComment.Visible = False
End If

My reason for wanting to do this is that there will only
be comments relevant to the report if the option selected
for the other field is 3.

Unfortunately, I don't have much experience writing VBA,
so if there's anything I've left out, please let me know.

Thanks for taking a look at this question for me.

Scott

-----Original Message-----
You appear to be using a textbox. If so, instead of
using
the field as the Control Source
of the textbox, use an equation.

Example:
=IIf([Field]=1, "First Value", IIf([Field]=2, "Second Value", "Other"))

You could place another textbox on the report that is
bound to the comment field. In the
OnFormat event of the Detail section you could set the
Visible property of this textbox.
If Nz(Me.txtComment, "") = "" Then
Me.txtComment.Visible = False
Else
Me.txtComment.Visible = True
End If
relate
or
.
 
D

Duane Hookom

Try:
=Choose([InvoiceLabelLocation], "On Equipment", "In Documentation",
[Comment] )
Make sure the name of the text box is not the name of a control.

--
Duane Hookom
Microsoft Access MVP


Scott A said:
I also have no idea as to why I'm returning a syntax error
with the following expression:

=IIf([InvoiceLabelLocation]=1, "On Equipment", IIf
([InvoiceLabelLocation]=2, "In Documentation"))


InvoiceLabelLocation is one of the fields returned by the
query upon which the report is based, and contains the
values stored by the option group on the form...

-----Original Message-----
I think that covers what I want to do with values 1 and
2...

As for the third value ("Other"), I'm wondering if
something a little tricker will work - if you would be so
kind as to look this over, I would love a second opinion:

If [Field]= 3 Then
Me.txtComment.Visible = True
Else
Me.txtComment.Visible = False
End If

My reason for wanting to do this is that there will only
be comments relevant to the report if the option selected
for the other field is 3.

Unfortunately, I don't have much experience writing VBA,
so if there's anything I've left out, please let me know.

Thanks for taking a look at this question for me.

Scott

-----Original Message-----
You appear to be using a textbox. If so, instead of
using
the field as the Control Source
of the textbox, use an equation.

Example:
=IIf([Field]=1, "First Value", IIf([Field]=2, "Second Value", "Other"))

You could place another textbox on the report that is
bound to the comment field. In the
OnFormat event of the Detail section you could set the
Visible property of this textbox.
If Nz(Me.txtComment, "") = "" Then
Me.txtComment.Visible = False
Else
Me.txtComment.Visible = True
End If

--
Wayne Morgan


I would like to do something really cool on a report, but
am not sure how to accomplish it...

I'm dealing with data that is entered using an option
group with three options. Option 1 and Option 2
relate
to
literal values, but Option 3 is "Other" and directs the
user to enter comments into a comment field.

Here's where I need some help:

Firstly, all I'm getting on my report are the values
stored in the database for each of the options in the
group (the numbers 1, 2, or 3). How do I make it so the
control on the report displays the literal values that
these numbers represent???

Secondly, it would be really cool that if the value were
3, that I could display the comment field instead of
or
in
addition to the literal. Any ideas???

Thanks!

Scott


.
.
 

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