Referencing a field that ends in #

BroncoMarc

Registered User.
Local time
Today, 19:15
Joined
Apr 4, 2002
Messages
43
How do I reference a field that ends with a # symbol?

For example My Field #

I tried My_Field_#.Text but it didn't like that. I checked what Access called it if I tried to make that field an event. It made it My_Field___BeforeUpdate. I tried variations of that, but couldn't get it to work.

Thanks..
- Marc
 
Surround it with square brackets

i.e.

[My_Field_with_the_stupid_name#]


Try to avoid using spaces, underscores, and special characters in field names (best practice) and then situations like this don't happen. ;)
 
I tried that already. It gives me "Microsoft Access can't find the field '|' referred to in your expression"

Here is exactly what I'm trying:

COMMENTS_TO_PRINT = "Credit Req " + [REQ_#].Text


I wish the fields had normal names with no spaces.. This is what happens when the user makes their own database.

- Marc
 
:confused:


Put the message box line before it and observe the two changes in the line below. Does the message box give the value of the field? Is [REQ_#] a field or a textbox?

MsgBox Me.[REQ_#]
COMMENTS_TO_PRINT = "Credit Req " & Me.[REQ_#]


What's COMMENTS_TO_PRINT?

Tried square brackets around that?
 
The MsgBox line gave me the same error. COMMENTS_TO_PRINT is a text box.

I noticed after I typed Me. it popped up with a list of options. One of the choices was REQ__ so I tried that and it worked!

This is what I ended up with:

COMMENTS_TO_PRINT = "Credit Req " & REQ__


I thought I had tried that before, but it works now.

Thanks..
- Marc
 

Users who are viewing this thread

Back
Top Bottom