How to add conditional information

J

JamiLea

I am needing to know how I can add information to a report based on the state
the report is in. For example I am creating letters in an Access report and
if the letter is to be sent to CA then i need to enter this information: If
you feel you have been wrongfully denied reimbursement, you may contact the
California Department of Insurance at 300 South Spring Street, South Tower,
Suite 201, Los Angeles, CA 90013, in writing. The telephone number is: (800)
927-4357. If the letter is not CA then I do not need to add anything.
 
A

Al Campagna

JamiLea,
Essentially... and there are several ways to do that...

Use the OnFormat event of the report section where this blurb prints.
If State = "CA" Then
CaliforniaBlurb.Visible = True
Else
CaliforniaBlurb.Visible = False
End
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
J

JamiLea via AccessMonster.com

I don't think I understand how to make this work. I tried doing this in the
but where i need the blurb to print and the state are in differenet sections.

Al said:
JamiLea,
Essentially... and there are several ways to do that...

Use the OnFormat event of the report section where this blurb prints.
If State = "CA" Then
CaliforniaBlurb.Visible = True
Else
CaliforniaBlurb.Visible = False
End
I am needing to know how I can add information to a report based on the
state
[quoted text clipped - 9 lines]
(800)
927-4357. If the letter is not CA then I do not need to add anything.
 
F

fredg

I am needing to know how I can add information to a report based on the state
the report is in. For example I am creating letters in an Access report and
if the letter is to be sent to CA then i need to enter this information: If
you feel you have been wrongfully denied reimbursement, you may contact the
California Department of Insurance at 300 South Spring Street, South Tower,
Suite 201, Los Angeles, CA 90013, in writing. The telephone number is: (800)
927-4357. If the letter is not CA then I do not need to add anything.

Here is one way.
Add a label control to the report where you wish to display that
information.
Set it's Caption property to:
If you feel you have been wrongfully ... etc. ... (800) 927-4357

Code the Format Event of the Section that contains the [State] field:
LableName.Visible = [State] = "CA"
 
J

JamiLea via AccessMonster.com

I tired that an the CA blurb is showing up on all of the letters even if the
property address is not in CA
I am needing to know how I can add information to a report based on the state
the report is in. For example I am creating letters in an Access report and
[quoted text clipped - 3 lines]
Suite 201, Los Angeles, CA 90013, in writing. The telephone number is: (800)
927-4357. If the letter is not CA then I do not need to add anything.

Here is one way.
Add a label control to the report where you wish to display that
information.
Set it's Caption property to:
If you feel you have been wrongfully ... etc. ... (800) 927-4357

Code the Format Event of the Section that contains the [State] field:
LableName.Visible = [State] = "CA"
 
A

Al Campagna

JamiLea,
Whenever you have a problem with code, and it doesn't work out,
"cut & paste exactly" the code you have, and where you placed that
code, in your reply.

Fred's code is correct, so...

Make sure you've put your code in the correct report section, and
that you've properly identified the label involved within that report
section,
and that the text control name State is also in this report section
(hidden or not), and that the value of State is really "CA".

Let's see the code nyo have...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


JamiLea via AccessMonster.com said:
I tired that an the CA blurb is showing up on all of the letters even if
the
property address is not in CA
I am needing to know how I can add information to a report based on the
state
the report is in. For example I am creating letters in an Access report
and
[quoted text clipped - 3 lines]
Suite 201, Los Angeles, CA 90013, in writing. The telephone number is:
(800)
927-4357. If the letter is not CA then I do not need to add anything.

Here is one way.
Add a label control to the report where you wish to display that
information.
Set it's Caption property to:
If you feel you have been wrongfully ... etc. ... (800) 927-4357

Code the Format Event of the Section that contains the [State] field:
LableName.Visible = [State] = "CA"
 
F

fredg

I tired that an the CA blurb is showing up on all of the letters even if the
property address is not in CA
I am needing to know how I can add information to a report based on the state
the report is in. For example I am creating letters in an Access report and
[quoted text clipped - 3 lines]
Suite 201, Los Angeles, CA 90013, in writing. The telephone number is: (800)
927-4357. If the letter is not CA then I do not need to add anything.

Here is one way.
Add a label control to the report where you wish to display that
information.
Set it's Caption property to:
If you feel you have been wrongfully ... etc. ... (800) 927-4357

Code the Format Event of the Section that contains the [State] field:
LableName.Visible = [State] = "CA"


What is the "exact" code you wrote?
Does the [State] field return a text value "CA" or is it a look-up
field that actually contains a Number value?
Did you change [State] to whatever the actual control name on your
report is?

Here is an alternative method.
Add an unbound text control to the report (instead of the label).
Set it's control source to:
=IIf([State] = "CA","If you feel you have been wrongfully ... etc. ...
(800) 927-4357","")
No coding necessary if you use this method.
It is important that the field named [State] actually contains text,
i.e. "CA", or AZ" etc. and not a Lookup value.
If it is actually a lookup value then substitute the state's number
value (without quotes).

=IIf([State] = 8,"If you feel ...etc..)
 
J

JamiLea via AccessMonster.com

I got this expression to work >=IIf([PState] = "CA","If you feel you have
been wrongfully ... etc. ...
(800) 927-4357",""). Thank you VERY much!!
I tired that an the CA blurb is showing up on all of the letters even if the
property address is not in CA
[quoted text clipped - 13 lines]
Code the Format Event of the Section that contains the [State] field:
LableName.Visible = [State] = "CA"

What is the "exact" code you wrote?
Does the [State] field return a text value "CA" or is it a look-up
field that actually contains a Number value?
Did you change [State] to whatever the actual control name on your
report is?

Here is an alternative method.
Add an unbound text control to the report (instead of the label).
Set it's control source to:
=IIf([State] = "CA","If you feel you have been wrongfully ... etc. ...
(800) 927-4357","")
No coding necessary if you use this method.
It is important that the field named [State] actually contains text,
i.e. "CA", or AZ" etc. and not a Lookup value.
If it is actually a lookup value then substitute the state's number
value (without quotes).

=IIf([State] = 8,"If you feel ...etc..)
 

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