Why wont this statement work

  • Thread starter Thread starter dgrdinh
  • Start date Start date
D

dgrdinh

Hello, building reports in access for the first time. I'm putting
expressions into Text Boxes but get odd results. I have a field in a
table for a name of a person, its called "NAME".

when I put

NAME

into the textbox I get the persons name: Andy

when I put

="Hi There " + [NAME]

I want "Hi There Andy" but get "Hi There Reports By Class",

where Reports by Class is the name of my report. Why is it sometimes
getting the "name" property from the table in some cases and the "name"
of the report in others? whats the rule? How do I specify to use the
"name" of the table and not the "name" of the report?
 
Name is not a good name for a field. Most objects in Access have a Name
property, so you could end up with Access showing the name of the report
instead of the contents of the Name field.

You also need to make sure that this text box is not named Name or any other
field name: Access gets confused if a control has the same name as a field,
but is bound to something else.
 
Hello, building reports in access for the first time. I'm putting
expressions into Text Boxes but get odd results. I have a field in a
table for a name of a person, its called "NAME".

when I put

NAME

into the textbox I get the persons name: Andy

when I put

="Hi There " + [NAME]

I want "Hi There Andy" but get "Hi There Reports By Class",

where Reports by Class is the name of my report. Why is it sometimes
getting the "name" property from the table in some cases and the "name"
of the report in others? whats the rule? How do I specify to use the
"name" of the table and not the "name" of the report?

Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
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'

After you change the [Name] field to something else,
="Hi there " & [AField]
will work. Make sure the name of the control is not "AField"
 
In your table use 'srtName' for the field name ('str' is a memory jogger
which will tell you at a glance that the field contains string data) ... by
using a filed naming convention like this you overcome forever the danger
that you'll use a word reserved by Access/VB/JET ... Cheers ...

fredg said:
Hello, building reports in access for the first time. I'm putting
expressions into Text Boxes but get odd results. I have a field in a
table for a name of a person, its called "NAME".

when I put

NAME

into the textbox I get the persons name: Andy

when I put

="Hi There " + [NAME]

I want "Hi There Andy" but get "Hi There Reports By Class",

where Reports by Class is the name of my report. Why is it sometimes
getting the "name" property from the table in some cases and the "name"
of the report in others? whats the rule? How do I specify to use the
"name" of the table and not the "name" of the report?

Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
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'

After you change the [Name] field to something else,
="Hi there " & [AField]
will work. Make sure the name of the control is not "AField"
 
Back
Top