Combining fields in a report

  • Thread starter Thread starter Nodge
  • Start date Start date
N

Nodge

I'm a complete noob with Access and I'm struggling to produce a report for a
simple contact database. The first field in my record is for "Initials" the
second is for "Name" the third for "Address1" and so on. I want to print out
the name and address where the first line is a combination of Initials +
Name with a single space between.

I've entered this into a text control in my report as =[INITIALS]+" "+[NAME]

This sort of works. It's fine where there is an initial so I might get A. B.
Smith for instance. The problem is where there is nothing entered in the
Initals field then the Name isn't printed out either. So I just get the
following address with no name on the first line.

I just can't figure out where I'm going wrong.

Any help much appreciated. I'm using Office 2000.

TIA
Nodge
 
Nodge,
First, don't use "Name" as the name of a field. It's a reserved word and may cause
problems. Try [LastName] instead.

Try
= [Initails] & " " & [LastName]
(Text strings are concatenated using the &, not +)

If Initials is null the result will be " Smith" So...to avoid the space... use this
instead.
= IIF(IsNull([Initials]), [LastName], [Initials] & " " & [LastName])
 
Al Campagna said:
Nodge,
First, don't use "Name" as the name of a field. It's a reserved word and may cause
problems. Try [LastName] instead.

Try
= [Initails] & " " & [LastName]
(Text strings are concatenated using the &, not +)

If Initials is null the result will be " Smith" So...to avoid the space... use this
instead.
= IIF(IsNull([Initials]), [LastName], [Initials] & " " & [LastName])
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
Not sure what I did before to get that error message but tried again using

=IF(IsNull([Initials]),[Customer],[Initials] & " " & [Customer])

And now if I do a print preview I get another window pop up saying Enter
Parameter Value. There's a text entry box waiting fo rme to enter a value
and it has the word IF above it.

Any ideas?

Nodge
 
Change
=IF(IsNull([Initials]),[Customer],[Initials] & " " & [Customer])
to
=IIF(IsNull([Initials]),[Customer],[Initials] & " " & [Customer])

The function is IIF with two 'eyes' and not one.

Nodge said:
Al Campagna said:
Nodge,
First, don't use "Name" as the name of a field. It's a reserved word and may cause
problems. Try [LastName] instead.

Try
= [Initails] & " " & [LastName]
(Text strings are concatenated using the &, not +)

If Initials is null the result will be " Smith" So...to avoid the space... use this
instead.
= IIF(IsNull([Initials]), [LastName], [Initials] & " " & [LastName])
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
Not sure what I did before to get that error message but tried again using

=IF(IsNull([Initials]),[Customer],[Initials] & " " & [Customer])

And now if I do a print preview I get another window pop up saying Enter
Parameter Value. There's a text entry box waiting fo rme to enter a value
and it has the word IF above it.

Any ideas?

Nodge
 
Susan,

Well, as far as I can see... no. I am not sure what you would hope to
achieve by this.

In any case, the Me. would indicate that you are thinking VBA procedure,
which does not relate to Nodge's question.
 
sorry, my mistake. Thanks for clarification!
=)

Steve Schapel said:
Susan,

Well, as far as I can see... no. I am not sure what you would hope to
achieve by this.

In any case, the Me. would indicate that you are thinking VBA procedure,
which does not relate to Nodge's question.
 
Steve,
I wrote...
= [Initails] & " " & [LastName]
If Initials is Null, the string comes out as " Smith" because of the space (" ") in the
concatenation.
That's why I suggested...
= IIF(IsNull([Initials]), [LastName], [Initials] & " " & [LastName])

Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



Steve Schapel said:
Al said:
If Initials is null the result will be " Smith"

Nope. If [Initials] is null, the result will be null.
 
My apologies, Al. I read it in the context of the original expression.
You are quite correct. Sorry.
 
Back
Top