Conditional statement in a Report Field ??

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

rptDemo is built on qryDemo

Here is what I would like to know how to do in the report...

If [Prime Location] = True Then Display "True"

1 - Can you put statements directly into a field in a Report?
2 - If so what is the correct syntax?
3 - If no then how?

Thanks for any help.
 
Set the text box's control source to

=IIf([Prime Location] True, "True", "")

(including the equal sign)

Alternatively, bind the text box to the Prime Location field, and set its
format to

;True;

(that's a semi-colon before and after the word True)
 
What if we want about these 2 cases?

If [status]="declined" then display "DECLINED SO IGNORE THIS ACCOUNT]

or this caes...

If [status] = "declined' then set FontWeight = Bold

Hopefully with these two additional examples I will be able to have enough
to figgure out syntax for other cases.

Thanks for the help


Douglas J. Steele said:
Set the text box's control source to

=IIf([Prime Location] True, "True", "")

(including the equal sign)

Alternatively, bind the text box to the Prime Location field, and set its
format to

;True;

(that's a semi-colon before and after the word True)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Will said:
rptDemo is built on qryDemo

Here is what I would like to know how to do in the report...

If [Prime Location] = True Then Display "True"

1 - Can you put statements directly into a field in a Report?
2 - If so what is the correct syntax?
3 - If no then how?

Thanks for any help.
 
First, I noticed that there was an error in what I posted earlier. It should
be

=IIf([Prime Location] = True, "True", "")

or

=IIf([Prime Location], "True", "")

Now to your new questions.

For the first, it would be

=IIf([status] = "declined", "DECLINED SO IGNORE THIS ACCOUNT!", "")

You can't use an IIf statement to set font weight. Look into Conditional
Formating for that.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Will said:
What if we want about these 2 cases?

If [status]="declined" then display "DECLINED SO IGNORE THIS ACCOUNT]

or this caes...

If [status] = "declined' then set FontWeight = Bold

Hopefully with these two additional examples I will be able to have enough
to figgure out syntax for other cases.

Thanks for the help


Douglas J. Steele said:
Set the text box's control source to

=IIf([Prime Location] True, "True", "")

(including the equal sign)

Alternatively, bind the text box to the Prime Location field, and set its
format to

;True;

(that's a semi-colon before and after the word True)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Will said:
rptDemo is built on qryDemo

Here is what I would like to know how to do in the report...

If [Prime Location] = True Then Display "True"

1 - Can you put statements directly into a field in a Report?
2 - If so what is the correct syntax?
3 - If no then how?

Thanks for any help.
 
Thanks Doug. Great info... as always.


Douglas J. Steele said:
First, I noticed that there was an error in what I posted earlier. It
should be

=IIf([Prime Location] = True, "True", "")

or

=IIf([Prime Location], "True", "")

Now to your new questions.

For the first, it would be

=IIf([status] = "declined", "DECLINED SO IGNORE THIS ACCOUNT!", "")

You can't use an IIf statement to set font weight. Look into Conditional
Formating for that.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Will said:
What if we want about these 2 cases?

If [status]="declined" then display "DECLINED SO IGNORE THIS ACCOUNT]

or this caes...

If [status] = "declined' then set FontWeight = Bold

Hopefully with these two additional examples I will be able to have
enough to figgure out syntax for other cases.

Thanks for the help


Douglas J. Steele said:
Set the text box's control source to

=IIf([Prime Location] True, "True", "")

(including the equal sign)

Alternatively, bind the text box to the Prime Location field, and set
its format to

;True;

(that's a semi-colon before and after the word True)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


rptDemo is built on qryDemo

Here is what I would like to know how to do in the report...

If [Prime Location] = True Then Display "True"

1 - Can you put statements directly into a field in a Report?
2 - If so what is the correct syntax?
3 - If no then how?

Thanks for any help.
 

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

Back
Top