trim function

G

Guest

I am using Access 2000.
I created a simple database with names and address for a mail merge. One of
the fields is "name" and another is "title". I wanted to put both of these
together on one line so I created the following formula - =trim([name]&",
"&[title])
But instead of the name that is in the record, it is giving me the name of
the report which is "InLtr". When I first created the report (before I save
it) the formula gave me "Report1, and the correct title". Now that I have
saved the report as "InLtr", I get "Inltr, and the correct title".

Does anyone have any idea as to why this is happening? I used the same
formula for City and State and do not have a problem with this. I need HELP
- PLEASE.

Aurora
 
J

John Spencer

Are you sure that Name is surrounded by square brackets []? The problem is
Name without the brackets is very likely to give the name of the report (as
you have found out).

If you can I suggest you fix the name of the field to PersonName or some
other non-reserved word. If you can't do this, try setting an alias of the
name in the underlying query.

Field: TheName: [Tablename].[Name]

Then you can use TheName in your report and shouldn't have the problem. If
your report is sorted on Name, then make sure you also change the sorting
and grouping.
 
F

fredg

I am using Access 2000.
I created a simple database with names and address for a mail merge. One of
the fields is "name" and another is "title". I wanted to put both of these
together on one line so I created the following formula - =trim([name]&",
"&[title])
But instead of the name that is in the record, it is giving me the name of
the report which is "InLtr". When I first created the report (before I save
it) the formula gave me "Report1, and the correct title". Now that I have
saved the report as "InLtr", I get "Inltr, and the correct title".

Does anyone have any idea as to why this is happening? I used the same
formula for City and State and do not have a problem with this. I need HELP
- PLEASE.

Aurora



Name is a reserved Access/VBA/Jet word and should not be used as a
field name. It refers to the name of the current object, in this case
your report name.

For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

Change "Name" to "CustomerName" or something similar.
 

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