Access 2003 Report - want only one field with a value to show

G

Guest

I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it might be one
or the other.

I then do a query-based report which has both fields on it, but I only want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried playing with the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
D

Duane Hookom

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a "value"
property.
 
G

Guest

I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say something like
"Price = $ 20.00", but if the Punch Value field instead has a value, the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and adding a text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch Value])].

And get a similar Syntax eror box tyring to use your 2nd suggestion


Duane Hookom said:
Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a "value"
property.

--
Duane Hookom
MS Access MVP

FrankSpokane said:
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it might be
one
or the other.

I then do a query-based report which has both fields on it, but I only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried playing with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
D

Duane Hookom

I'm not sure why you didn't provide this information in your original post.
If one or the other is always null you can try a single text box with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



FrankSpokane said:
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say something
like
"Price = $ 20.00", but if the Punch Value field instead has a value, the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and adding a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch Value])].

And get a similar Syntax eror box tyring to use your 2nd suggestion


Duane Hookom said:
Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a
"value"
property.

--
Duane Hookom
MS Access MVP

FrankSpokane said:
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it might be
one
or the other.

I then do a query-based report which has both fields on it, but I only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
G

Guest

I cut and pasted that in but it still doesn't work. I get a error msg box
that starts with "Extra ) in query expression ..."

Duane Hookom said:
I'm not sure why you didn't provide this information in your original post.
If one or the other is always null you can try a single text box with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



FrankSpokane said:
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say something
like
"Price = $ 20.00", but if the Punch Value field instead has a value, the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and adding a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch Value])].

And get a similar Syntax eror box tyring to use your 2nd suggestion


Duane Hookom said:
Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a
"value"
property.

--
Duane Hookom
MS Access MVP

I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it might be
one
or the other.

I then do a query-based report which has both fields on it, but I only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
G

Guest

Ok I got rid of that error msg, and it kind of works using the below code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click through, and
then the Price field will show up correctly, but not the Punch value field,
if ones exists.


FrankSpokane said:
I cut and pasted that in but it still doesn't work. I get a error msg box
that starts with "Extra ) in query expression ..."

Duane Hookom said:
I'm not sure why you didn't provide this information in your original post.
If one or the other is always null you can try a single text box with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



FrankSpokane said:
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say something
like
"Price = $ 20.00", but if the Punch Value field instead has a value, the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and adding a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch Value])].

And get a similar Syntax eror box tyring to use your 2nd suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a
"value"
property.

--
Duane Hookom
MS Access MVP

I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it might be
one
or the other.

I then do a query-based report which has both fields on it, but I only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
J

John Spencer

Question: Did you type the entry all on one line? IF you cut and pasted
from the posting there may be an extraneous character in the expression.

Try typing the entry in.

This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


FrankSpokane said:
Ok I got rid of that error msg, and it kind of works using the below code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click through, and
then the Price field will show up correctly, but not the Punch value
field,
if ones exists.


FrankSpokane said:
I cut and pasted that in but it still doesn't work. I get a error msg box
that starts with "Extra ) in query expression ..."

Duane Hookom said:
I'm not sure why you didn't provide this information in your original
post.
If one or the other is always null you can try a single text box with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has a value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a
"value"
property.

--
Duane Hookom
MS Access MVP

message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it
might be
one
or the other.

I then do a query-based report which has both fields on it, but I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
G

Guest

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

It is all one one line and I don't see any extra characters.

Do you think if I changed the name of my field [Punch Value] to just [Punch]
that might solve it, as previously Duane Hookum has said "BTW: Value is not a
good name for a field since many controls have a "value" property ?

Thanks



John Spencer said:
Question: Did you type the entry all on one line? IF you cut and pasted
from the posting there may be an extraneous character in the expression.
Try typing the entry in.This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


FrankSpokane said:
Ok I got rid of that error msg, and it kind of works using the below code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click through, and
then the Price field will show up correctly, but not the Punch value
field,
if ones exists.


FrankSpokane said:
I cut and pasted that in but it still doesn't work. I get a error msg box
that starts with "Extra ) in query expression ..."

:

I'm not sure why you didn't provide this information in your original
post.
If one or the other is always null you can try a single text box with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has a value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls have a
"value"
property.

--
Duane Hookom
MS Access MVP

message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch coupon

Only one of these fields are ever filled in per record, but it
might be
one
or the other.

I then do a query-based report which has both fields on it, but I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE OTHER.

Each field has a Fieldname label attached to it. I've tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
J

John Spencer

Don't see anything there that would cause a problem like you mention.

If you remove the expression completely, do you still get the prompt for
Punch? If so, then the prompt is coming from some place else.

FrankSpokane said:
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

It is all one one line and I don't see any extra characters.

Do you think if I changed the name of my field [Punch Value] to just
[Punch]
that might solve it, as previously Duane Hookum has said "BTW: Value is
not a
good name for a field since many controls have a "value" property ?

Thanks



John Spencer said:
Question: Did you type the entry all on one line? IF you cut and
pasted
from the posting there may be an extraneous character in the expression.
Try typing the entry in.This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


FrankSpokane said:
Ok I got rid of that error msg, and it kind of works using the below
code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click through,
and
then the Price field will show up correctly, but not the Punch value
field,
if ones exists.


:

I cut and pasted that in but it still doesn't work. I get a error msg
box
that starts with "Extra ) in query expression ..."

:

I'm not sure why you didn't provide this information in your
original
post.
If one or the other is always null you can try a single text box
with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has a
value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and
adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd
suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls
have a
"value"
property.

--
Duane Hookom
MS Access MVP

message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch
coupon

Only one of these fields are ever filled in per record, but it
might be
one
or the other.

I then do a query-based report which has both fields on it, but
I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE
OTHER.

Each field has a Fieldname label attached to it. I've tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
G

Guest

John:

If I remove the expression, I don't get the prompt for Punch.

To review, as this still isn't working and is very frustrating, my field
names now are [Price] and [Punch] and are both currency fields.

I have reviewed my table, query, and report and everything looks ok as far
as the new field names being correct everywhere..

What I want to do is the same, have one not show up if the other appears. If
there is a value in the Price field, I don't want the Punch field to show up,
or its label either. And vice versa.

The following code that someone on this forum suggested, and which I
modified, still doesn't work.

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch,"Currency"),"Value up to " & Format([Price],"Currency"))

I still get the prompt for Punch when I run it, and it doesn't work.

If there IS a Price, the Price field shows up with the correct price, but if
there ISN'T a price, the price field still shows up with a zero value, and
the Punch field doesn't show up at all, even hough there is a value in it.

Sorry this is so complicated but this is the only place I rely on for help -
thanks.





John Spencer said:
Don't see anything there that would cause a problem like you mention.

If you remove the expression completely, do you still get the prompt for
Punch? If so, then the prompt is coming from some place else.

FrankSpokane said:
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

It is all one one line and I don't see any extra characters.

Do you think if I changed the name of my field [Punch Value] to just
[Punch]
that might solve it, as previously Duane Hookum has said "BTW: Value is
not a
good name for a field since many controls have a "value" property ?

Thanks



John Spencer said:
Question: Did you type the entry all on one line? IF you cut and
pasted
from the posting there may be an extraneous character in the expression.
Try typing the entry in.This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


Ok I got rid of that error msg, and it kind of works using the below
code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click through,
and
then the Price field will show up correctly, but not the Punch value
field,
if ones exists.


:

I cut and pasted that in but it still doesn't work. I get a error msg
box
that starts with "Extra ) in query expression ..."

:

I'm not sure why you didn't provide this information in your
original
post.
If one or the other is always null you can try a single text box
with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has a
value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and
adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd
suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls
have a
"value"
property.

--
Duane Hookom
MS Access MVP

message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch
coupon

Only one of these fields are ever filled in per record, but it
might be
one
or the other.

I then do a query-based report which has both fields on it, but
I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE
OTHER.

Each field has a Fieldname label attached to it. I've tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
D

Duane Hookom

You were missing a "]" following "& Format([Punch".

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch],"Currency"),"Value up to " & Format([Price],"Currency"))

This all assumes you can view the fields Price and Punch in your field list
of your report. Also, the name of this text box should not be the name of a
field.

--
Duane Hookom
MS Access MVP


FrankSpokane said:
John:

If I remove the expression, I don't get the prompt for Punch.

To review, as this still isn't working and is very frustrating, my field
names now are [Price] and [Punch] and are both currency fields.

I have reviewed my table, query, and report and everything looks ok as far
as the new field names being correct everywhere..

What I want to do is the same, have one not show up if the other appears.
If
there is a value in the Price field, I don't want the Punch field to show
up,
or its label either. And vice versa.

The following code that someone on this forum suggested, and which I
modified, still doesn't work.

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch,"Currency"),"Value up to " & Format([Price],"Currency"))

I still get the prompt for Punch when I run it, and it doesn't work.

If there IS a Price, the Price field shows up with the correct price, but
if
there ISN'T a price, the price field still shows up with a zero value,
and
the Punch field doesn't show up at all, even hough there is a value in it.

Sorry this is so complicated but this is the only place I rely on for
help -
thanks.





John Spencer said:
Don't see anything there that would cause a problem like you mention.

If you remove the expression completely, do you still get the prompt for
Punch? If so, then the prompt is coming from some place else.

FrankSpokane said:
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

It is all one one line and I don't see any extra characters.

Do you think if I changed the name of my field [Punch Value] to just
[Punch]
that might solve it, as previously Duane Hookum has said "BTW: Value is
not a
good name for a field since many controls have a "value" property ?

Thanks



:
Question: Did you type the entry all on one line? IF you cut and
pasted
from the posting there may be an extraneous character in the
expression.
Try typing the entry in.This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


message
Ok I got rid of that error msg, and it kind of works using the below
code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click
through,
and
then the Price field will show up correctly, but not the Punch value
field,
if ones exists.


:

I cut and pasted that in but it still doesn't work. I get a error
msg
box
that starts with "Extra ) in query expression ..."

:

I'm not sure why you didn't provide this information in your
original
post.
If one or the other is always null you can try a single text box
with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has a
value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and
adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd
suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control
source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls
have a
"value"
property.

--
Duane Hookom
MS Access MVP

in
message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch
coupon

Only one of these fields are ever filled in per record, but
it
might be
one
or the other.

I then do a query-based report which has both fields on it,
but
I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE
OTHER.

Each field has a Fieldname label attached to it. I've tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
G

Guest

No it's in there - just hard to cut and past minutia like this.

My actual current code does say:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
],"Currency"),"Value up to " & Format([Price],"Currency"))

and it doesn't work.

It would be nice to have this window a lot bigger. so everythign isn't so
scrunched.



Duane Hookom said:
You were missing a "]" following "& Format([Punch".

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch],"Currency"),"Value up to " & Format([Price],"Currency"))

This all assumes you can view the fields Price and Punch in your field list
of your report. Also, the name of this text box should not be the name of a
field.

--
Duane Hookom
MS Access MVP


FrankSpokane said:
John:

If I remove the expression, I don't get the prompt for Punch.

To review, as this still isn't working and is very frustrating, my field
names now are [Price] and [Punch] and are both currency fields.

I have reviewed my table, query, and report and everything looks ok as far
as the new field names being correct everywhere..

What I want to do is the same, have one not show up if the other appears.
If
there is a value in the Price field, I don't want the Punch field to show
up,
or its label either. And vice versa.

The following code that someone on this forum suggested, and which I
modified, still doesn't work.

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch,"Currency"),"Value up to " & Format([Price],"Currency"))

I still get the prompt for Punch when I run it, and it doesn't work.

If there IS a Price, the Price field shows up with the correct price, but
if
there ISN'T a price, the price field still shows up with a zero value,
and
the Punch field doesn't show up at all, even hough there is a value in it.

Sorry this is so complicated but this is the only place I rely on for
help -
thanks.





John Spencer said:
Don't see anything there that would cause a problem like you mention.

If you remove the expression completely, do you still get the prompt for
Punch? If so, then the prompt is coming from some place else.

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

It is all one one line and I don't see any extra characters.

Do you think if I changed the name of my field [Punch Value] to just
[Punch]
that might solve it, as previously Duane Hookum has said "BTW: Value is
not a
good name for a field since many controls have a "value" property ?

Thanks



:
Question: Did you type the entry all on one line? IF you cut and
pasted
from the posting there may be an extraneous character in the
expression.
Try typing the entry in.This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


message
Ok I got rid of that error msg, and it kind of works using the below
code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click
through,
and
then the Price field will show up correctly, but not the Punch value
field,
if ones exists.


:

I cut and pasted that in but it still doesn't work. I get a error
msg
box
that starts with "Extra ) in query expression ..."

:

I'm not sure why you didn't provide this information in your
original
post.
If one or the other is always null you can try a single text box
with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " & Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has a
value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels, and
adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price], [Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd
suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control
source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many controls
have a
"value"
property.

--
Duane Hookom
MS Access MVP

in
message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special Punch
coupon

Only one of these fields are ever filled in per record, but
it
might be
one
or the other.

I then do a query-based report which has both fields on it,
but
I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE
OTHER.

Each field has a Fieldname label attached to it. I've tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks much.
 
D

Duane Hookom

Define "doesn't work". You can see your results and we can't.
Are you getting an error message? If you view the datasheet of the report's
record source do you get any prompts or errors?

What is the exact error?

--
Duane Hookom
MS Access MVP

FrankSpokane said:
No it's in there - just hard to cut and past minutia like this.

My actual current code does say:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
],"Currency"),"Value up to " & Format([Price],"Currency"))

and it doesn't work.

It would be nice to have this window a lot bigger. so everythign isn't so
scrunched.



Duane Hookom said:
You were missing a "]" following "& Format([Punch".

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch],"Currency"),"Value up to " & Format([Price],"Currency"))

This all assumes you can view the fields Price and Punch in your field
list
of your report. Also, the name of this text box should not be the name of
a
field.

--
Duane Hookom
MS Access MVP


FrankSpokane said:
John:

If I remove the expression, I don't get the prompt for Punch.

To review, as this still isn't working and is very frustrating, my
field
names now are [Price] and [Punch] and are both currency fields.

I have reviewed my table, query, and report and everything looks ok as
far
as the new field names being correct everywhere..

What I want to do is the same, have one not show up if the other
appears.
If
there is a value in the Price field, I don't want the Punch field to
show
up,
or its label either. And vice versa.

The following code that someone on this forum suggested, and which I
modified, still doesn't work.

=IIf(IsNull([Price]),"Per Punch Value up to: " &
Format([Punch,"Currency"),"Value up to " &
Format([Price],"Currency"))

I still get the prompt for Punch when I run it, and it doesn't work.

If there IS a Price, the Price field shows up with the correct price,
but
if
there ISN'T a price, the price field still shows up with a zero value,
and
the Punch field doesn't show up at all, even hough there is a value in
it.

Sorry this is so complicated but this is the only place I rely on for
help -
thanks.





:

Don't see anything there that would cause a problem like you mention.

If you remove the expression completely, do you still get the prompt
for
Punch? If so, then the prompt is coming from some place else.

message
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

It is all one one line and I don't see any extra characters.

Do you think if I changed the name of my field [Punch Value] to just
[Punch]
that might solve it, as previously Duane Hookum has said "BTW: Value
is
not a
good name for a field since many controls have a "value" property ?

Thanks



:
Question: Did you type the entry all on one line? IF you cut and
pasted
from the posting there may be an extraneous character in the
expression.
Try typing the entry in.This should all be one line.
=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],
"Currency"), "Value up to " & Format([Price],"Currency"))


message
Ok I got rid of that error msg, and it kind of works using the
below
code:

=IIf(IsNull([Price]),"Per Punch Value up to: " & Format([Punch
Value],"Currency"),"Value up to " & Format([Price],"Currency"))

However, it prompts me for a "Punch" which I can just click
through,
and
then the Price field will show up correctly, but not the Punch
value
field,
if ones exists.


:

I cut and pasted that in but it still doesn't work. I get a
error
msg
box
that starts with "Extra ) in query expression ..."

:

I'm not sure why you didn't provide this information in your
original
post.
If one or the other is always null you can try a single text
box
with a
control source like:

=IIf(IsNull([Price]) , "Per Punch Value up to: " &
Format([Punch
Value],"Currency"), "Price = " & Format([Price],"Currency")

Make sure the name is not the same as a field name.


--
Duane Hookom
MS Access MVP



in
message
I don't understand your syntax to use:

My actual Field names are [Price] and [Punch Value]:

I need one field or the other to show up.

If the Price field has a value, then the text box should say
something
like
"Price = $ 20.00", but if the Punch Value field instead has
a
value,
the
textbox should say "Per Punch Value up to: $ 20.00"

I tried taking out both the 2 existing fields and labels,
and
adding
a
text
box with the below Control Source:

Text 136 =Nz([Price], [Punch Value])

But then I get this error message:

Syntax Error (comma) in Query Expression '[ =NZ([Price],
[Punch
Value])].

And get a similar Syntax eror box tyring to use your 2nd
suggestion


:

Use a single text box with a control source like:
=Nz([Value], [Punchvalue])
You can change the label to a text box and set its control
source
to:
=IIf(IsNull([Value]),"Punch Value:","Value:")

BTW: Value is not a good name for a field since many
controls
have a
"value"
property.

--
Duane Hookom
MS Access MVP

"FrankSpokane" <[email protected]>
wrote
in
message
I have 2 fields in a table:
Value - valueof a coupon
Punchvalue - value of this coupon if it is a special
Punch
coupon

Only one of these fields are ever filled in per record,
but
it
might be
one
or the other.

I then do a query-based report which has both fields on
it,
but
I
only
want
THE ONE FIELD TO SHOW UP THAT HAS A VALUE IN IT - NOT THE
OTHER.

Each field has a Fieldname label attached to it. I've
tried
playing
with
the
invisible feature but got nowhere.

Is there a way to do this? Thanks 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