HOw to inslert a formula into a report

W

W. Guy Delaney

Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how do I
insert one or the other of these formulas. When I insert the Address field
and then modify it to be like one of the formulas, I get an error message
when I run the report.
 
B

BruceM

Use either expression as the Control Source of a text box:

=Nz([Address], [PO Box])

=IIf(Len([Address])>1,[PO Box],[Address])

Note that I fixed some parentheses, etc. I think the first one is tidier,
assuming you cannot have a zero-length string, which is different from Null.

You could also use the expression in a query. At the top of a blank column
in query design view:

AddressChoice: Nz([Address], [PO Box])
 
W

W. Guy Delaney

I put =Nz([Address], [PO Box]) as the Control Source in a text box and when
I run the report it tells me to enter the parameter value for the PO Box.

BruceM said:
Use either expression as the Control Source of a text box:

=Nz([Address], [PO Box])

=IIf(Len([Address])>1,[PO Box],[Address])

Note that I fixed some parentheses, etc. I think the first one is tidier,
assuming you cannot have a zero-length string, which is different from
Null.

You could also use the expression in a query. At the top of a blank
column in query design view:

AddressChoice: Nz([Address], [PO Box])


W. Guy Delaney said:
Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the
Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how do I
insert one or the other of these formulas. When I insert the Address
field and then modify it to be like one of the formulas, I get an error
message when I run the report.
 
B

BruceM

Both [Address] and [PO Box] need to be fields in the report's Record Source.

W. Guy Delaney said:
I put =Nz([Address], [PO Box]) as the Control Source in a text box and
when I run the report it tells me to enter the parameter value for the PO
Box.

BruceM said:
Use either expression as the Control Source of a text box:

=Nz([Address], [PO Box])

=IIf(Len([Address])>1,[PO Box],[Address])

Note that I fixed some parentheses, etc. I think the first one is
tidier, assuming you cannot have a zero-length string, which is different
from Null.

You could also use the expression in a query. At the top of a blank
column in query design view:

AddressChoice: Nz([Address], [PO Box])


W. Guy Delaney said:
Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the
Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how do
I insert one or the other of these formulas. When I insert the Address
field and then modify it to be like one of the formulas, I get an error
message when I run the report.
 
W

W. Guy Delaney

The Record Source is "qryDirectory." In that query, both [Address] and [PO
Box] are present.


BruceM said:
Both [Address] and [PO Box] need to be fields in the report's Record
Source.

W. Guy Delaney said:
I put =Nz([Address], [PO Box]) as the Control Source in a text box and
when I run the report it tells me to enter the parameter value for the PO
Box.

BruceM said:
Use either expression as the Control Source of a text box:

=Nz([Address], [PO Box])

=IIf(Len([Address])>1,[PO Box],[Address])

Note that I fixed some parentheses, etc. I think the first one is
tidier, assuming you cannot have a zero-length string, which is
different from Null.

You could also use the expression in a query. At the top of a blank
column in query design view:

AddressChoice: Nz([Address], [PO Box])


Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the
Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how do
I insert one or the other of these formulas. When I insert the Address
field and then modify it to be like one of the formulas, I get an error
message when I run the report.
 
W

W. Guy Delaney

I am so sorry. I have POBox in my table and PO Box in the source code. A
space that should not be there. I'm truly sorry.


BruceM said:
Both [Address] and [PO Box] need to be fields in the report's Record
Source.

W. Guy Delaney said:
I put =Nz([Address], [PO Box]) as the Control Source in a text box and
when I run the report it tells me to enter the parameter value for the PO
Box.

BruceM said:
Use either expression as the Control Source of a text box:

=Nz([Address], [PO Box])

=IIf(Len([Address])>1,[PO Box],[Address])

Note that I fixed some parentheses, etc. I think the first one is
tidier, assuming you cannot have a zero-length string, which is
different from Null.

You could also use the expression in a query. At the top of a blank
column in query design view:

AddressChoice: Nz([Address], [PO Box])


Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the
Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how do
I insert one or the other of these formulas. When I insert the Address
field and then modify it to be like one of the formulas, I get an error
message when I run the report.
 
B

BruceM

No problem. That would do it. Is it fixed?

W. Guy Delaney said:
I am so sorry. I have POBox in my table and PO Box in the source code. A
space that should not be there. I'm truly sorry.


BruceM said:
Both [Address] and [PO Box] need to be fields in the report's Record
Source.

W. Guy Delaney said:
I put =Nz([Address], [PO Box]) as the Control Source in a text box and
when I run the report it tells me to enter the parameter value for the
PO Box.

"BruceM" <bamoob_at_yawhodotcalm.not> wrote in message
Use either expression as the Control Source of a text box:

=Nz([Address], [PO Box])

=IIf(Len([Address])>1,[PO Box],[Address])

Note that I fixed some parentheses, etc. I think the first one is
tidier, assuming you cannot have a zero-length string, which is
different from Null.

You could also use the expression in a query. At the top of a blank
column in query design view:

AddressChoice: Nz([Address], [PO Box])


Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the
Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how
do I insert one or the other of these formulas. When I insert the
Address field and then modify it to be like one of the formulas, I get
an error message when I run the report.
 
J

jacques guerin

W. Guy Delaney said:
Recently I asked for helpin trying to figure of how to write an llf
statement that will insert the
PO Box number into the Address Line of my Telephone Directory if the
Street
Address is blank.

Two people responded. One gave me this foimual:

NZ9[Address], [PO Box])

The other gave me this formula"

llf(Len([Address]>1,[PO Box,[Address])

In both cases, I have inserted the named from my own table.

When I go to the design view of the report I'm trying to create, how do I
insert one or the other of these formulas. When I insert the Address field
and then modify it to be like one of the formulas, I get an error message
when I run the report.
 

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