Referencing a field with a '_' in it

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

Hi All

Sorry if this is a really dumb question but I'm quite new to this.

I have a field in my db called "02_Title" (without the " of course).

Now this is not a problem, until I try to call the field to reference it in
a string in the coding of the form.

Example: strSubject = "Item: " & 02_Title & " (# " & ItemID & ")"

Now of course this keeps giving me an error on the _ in the field name.

Is there any way to get around this without changing my field as it is
heavily used in the forms of this DB?

Thanks all

Keith
 
Thank you

That worked great.

Keith

Andrew Smith said:
Enclose the field name in square brackets - [02_Title]

Keith said:
Hi All

Sorry if this is a really dumb question but I'm quite new to this.

I have a field in my db called "02_Title" (without the " of course).

Now this is not a problem, until I try to call the field to reference it in
a string in the coding of the form.

Example: strSubject = "Item: " & 02_Title & " (# " & ItemID & ")"

Now of course this keeps giving me an error on the _ in the field name.

Is there any way to get around this without changing my field as it is
heavily used in the forms of this DB?

Thanks all

Keith
 
By the way, Keith, the underscore is the reason your field requied square
brackets. It was because the name began with a number.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.



Keith said:
Thank you

That worked great.

Keith

Andrew Smith said:
Enclose the field name in square brackets - [02_Title]

Keith said:
Hi All

Sorry if this is a really dumb question but I'm quite new to this.

I have a field in my db called "02_Title" (without the " of course).

Now this is not a problem, until I try to call the field to reference
it
in
a string in the coding of the form.

Example: strSubject = "Item: " & 02_Title & " (# " & ItemID & ")"

Now of course this keeps giving me an error on the _ in the field name.

Is there any way to get around this without changing my field as it is
heavily used in the forms of this DB?

Thanks all

Keith
 
Yes, Steve. And I see that you had already provided the same information
also.
 
Thanks everyone for your help.

Have got it working now and will bear in mind the naming of my fields in
future.

Keith
 

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

Back
Top