Referencing a Column with a Space in VBA (1 Viewer)

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:27
Feb 19, 2002
You're discovering the effects of the bad practice of using special characters or embedded spaces.

Just FYI, when you create a control with embedded spaces or special characters in its name, Access substitutes underscores for the offending characters. You renamed the control to remove the offending characters so you didn't see what Access does internally. Create a new control by dragging the field from the RecordSource. Access will name it Certificate_Number. You can see the name is "Cert Num" but in code, intellisense gives you Me.Cert_Num. Play around. see what happens when you create two fields -- "Cert Num" and "Cert-Num". Given that "-" is also an illegal character, what does Access do? I'm not telling you. Check yourself.


Users who are viewing this thread

Top Bottom