Barbara
Barbara

Reputation: 14776

Ms access - Field name beginning with number. Compile error. Expected: =

I have a field called "1why". When I run this code

Me.1why.SetFocus

I get "Compile error. Expected: =". I'm sure it has to do with the name of my control beginning with a number, in fact if I rename it to "a1why" it works.

The most quick solution would be to rename my control however I would like to know how to fix it. I've tried putting the name between "" and () but this produces another serie of different errors.

Upvotes: 1

Views: 36

Answers (1)

Gustav
Gustav

Reputation: 55831

If you can fix, it would be with brackets:

Me![1why].SetFocus

But do rename it anyway.

Upvotes: 1

Related Questions