Substitute "NO" for value N in Report

  • Thread starter kev100 via AccessMonster.com
  • Start date
K

kev100 via AccessMonster.com

Can I Print a "NO" for value N in a Report.

I only have room for an N in the table field....but would like to print an NO
on the report.

THANKS
 
B

BruceM

In the control source for an unbound text box on the report:
=IIf([YourField] = "N", "No", "Yes")
This assumes the field's value is either Yes or No. You will see "yes"
unless the value is "N", in which case you will see "No".

Can't you modify the table field so that it can accept more than one
character?
 
K

kev100 via AccessMonster.com

Thanks very much....

In the control source for an unbound text box on the report:
=IIf([YourField] = "N", "No", "Yes")
This assumes the field's value is either Yes or No. You will see "yes"
unless the value is "N", in which case you will see "No".

The field could have several different values (Yes, No, Maybe, NA, etc). Is
it possible to only change it if it is an N...but to leave it as is if the
value is anything else?

Thanks

Can't you modify the table field so that it can accept more than one character?

Unfortunately....that is a fixed filed generated by another uneditable app...
so I have to make do.
 
B

BruceM

=IIf([YourField] = "N", "No", [YourField])

kev100 via AccessMonster.com said:
Thanks very much....

In the control source for an unbound text box on the report:
=IIf([YourField] = "N", "No", "Yes")
This assumes the field's value is either Yes or No. You will see "yes"
unless the value is "N", in which case you will see "No".

The field could have several different values (Yes, No, Maybe, NA, etc).
Is
it possible to only change it if it is an N...but to leave it as is if the
value is anything else?

Thanks

Can't you modify the table field so that it can accept more than one
character?

Unfortunately....that is a fixed filed generated by another uneditable
app...
so I have to make do.
 
K

kev100 via AccessMonster.com

Thanks very much...that will work perfectly.
=IIf([YourField] = "N", "No", [YourField])


In working through this....I ran in to one other similar situation.......and
I hope this is not too complicated / hassle of a question


The field above is referenced to print at one place on the report (just line
after line until all the records are done).

However, in that text box.......I sometimes needed the value that appears to
come from a Different field....but only if that other field contains a
specific value.

Example: The primary field is named Status. When the report prints...
whatever is in Status should be displayed in that text box (Yes, No(NO),
Maybe, etc.).......Unless the value of a secondary field (named Resp) is "msg.
"

If that is the case.....the value "msg" needs to be displayed....rather than
what is in the primary field Status.

Would a possible edit be...

=IIf([Resp] = "Msg", "Msg", [status])

?

Thanks
 
B

BruceM

=IIf([Resp] = "Msg", "Msg", [status]) will give you whatever is in [status]
unless [Resp] = "Msg". I'm not sure where [status] came from in your
example, but if it is the equivalent of [YourField] in my example you could
use nested IIf statements:

=IIf([Resp] = "Msg", "Msg", IIf([status] = "N", "No", [status]))

The logic is that IF [Resp] = "Msg", THEN put "Msg" into the text box, ELSE
evaluate another IIf statement (which is also an IF, THEN, ELSE statement).
I have used capital letters to emphasize the steps, not because they they
are part of the actual expression. Note the pair of closing parentheses
(one for each IIf).

kev100 via AccessMonster.com said:
Thanks very much...that will work perfectly.

In working through this....I ran in to one other similar
situation.......and
I hope this is not too complicated / hassle of a question


The field above is referenced to print at one place on the report (just
line
after line until all the records are done).

However, in that text box.......I sometimes needed the value that appears
to
come from a Different field....but only if that other field contains a
specific value.

Example: The primary field is named Status. When the report prints...
whatever is in Status should be displayed in that text box (Yes, No(NO),
Maybe, etc.).......Unless the value of a secondary field (named Resp) is
"msg.
"

If that is the case.....the value "msg" needs to be displayed....rather
than
what is in the primary field Status.

Would a possible edit be...

=IIf([Resp] = "Msg", "Msg", [status])

?

Thanks
 
K

kev100 via AccessMonster.com

Thanks VERY much....there are several places where I can use that function to
simply displaying data.

By the way....is:

"=IIf"

an = with a bar |, then If....or an If with 2 i's (e.g. iif...or IIf )?

Thanks

=IIf([Resp] = "Msg", "Msg", [status]) will give you whatever is in [status]
unless [Resp] = "Msg". I'm not sure where [status] came from in your
example, but if it is the equivalent of [YourField] in my example you could
use nested IIf statements:

=IIf([Resp] = "Msg", "Msg", IIf([status] = "N", "No", [status]))

The logic is that IF [Resp] = "Msg", THEN put "Msg" into the text box, ELSE
evaluate another IIf statement (which is also an IF, THEN, ELSE statement).
I have used capital letters to emphasize the steps, not because they they
are part of the actual expression. Note the pair of closing parentheses
(one for each IIf).
Thanks very much...that will work perfectly.
[quoted text clipped - 30 lines]
 
B

BruceM

The letter I twice. You could just type it in lower case. Access will
format it when you're done. I think it stands for Incremental If or
something of the sort.

kev100 via AccessMonster.com said:
Thanks VERY much....there are several places where I can use that function
to
simply displaying data.

By the way....is:

"=IIf"

an = with a bar |, then If....or an If with 2 i's (e.g. iif...or IIf )?

Thanks

=IIf([Resp] = "Msg", "Msg", [status]) will give you whatever is in
[status]
unless [Resp] = "Msg". I'm not sure where [status] came from in your
example, but if it is the equivalent of [YourField] in my example you
could
use nested IIf statements:

=IIf([Resp] = "Msg", "Msg", IIf([status] = "N", "No", [status]))

The logic is that IF [Resp] = "Msg", THEN put "Msg" into the text box,
ELSE
evaluate another IIf statement (which is also an IF, THEN, ELSE
statement).
I have used capital letters to emphasize the steps, not because they they
are part of the actual expression. Note the pair of closing parentheses
(one for each IIf).
Thanks very much...that will work perfectly.
[quoted text clipped - 30 lines]
 
K

kev100 via AccessMonster.com

I just gave that a quick test....

I did a right-click on the test box in the report form design page...

Selected the Data tab

Selected the Control Source field.

It currently has YourField in it

I replaced it with...

=IIf([YourField] = "N", "No", [YourField])


However, when I display the form with the data, the form will run and display
the other field data, but at YourField, it displays...

#Error

(regardless of the original data).

I also noticed on the report form in design mode, =IIf([YourField] = "N",
"No", [YourField]) displays where the field name used to.

Am I entering it in the correct area?

Thanks
 
B

BruceM

What is the name of the field containing the single letter to which you
referred to in your original posting? Whatever it is, that field name needs
to be in the formula instead of YourField.

If the Control Source for a text box is blank, that text box will show
"Unbound". If you add a Control Source, whether it is a field in the form's
Record Source or an expression such as the IIf expression, whatever is in
Control Source will be displayed when you view the form in design view.

One other thing to check is to be sure you do not have a text box (or other
control) with the same name as the field. When you drag a field onto a
form, the text box is given the same name as the field. I can't even
imagine why Access does this, as it can cause all sorts of errors. All of
my text boxes start with the letters "txt", combo boxes with "cbo", labels
with "lbl", and so forth. I try not to give either Access or myself a
chance to become confused.
 
K

kev100 via AccessMonster.com

Bruce,

This issue ended up being that it was a BOUND text box.

It was bound to one of the fields. It evidently cannot be bound to any field
for process to work.

I just replaced the text box in question with an unbound one then tried using
one field:

=IIf([Status] = "N", "No", [Status])

...as well as the multi:

=IIf([Resp] = "Msg", "Msg", IIf([status] = "N", "No", [status]))

both work GREAT.

Since we need to generate meaningful reports from tables which often have
scant data (lots of abbreviated entry formats, special codes, etc) this will
be VERY useful in other situations as well.

Thanks very much.
 

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