VBA code error

E

EjFizzy

I am getting this error message on a form:

Run-time error '2465':
Microsoft Office Access can't find the field '|' referred to in your
expression.

I go to Debug and this is where the error is:

Private Sub Other__info_sessions__presentations__education_etc__AfterUpdate()
If [Other__info_sessions__presentations__education_etc].Value = True Then
[Walk_in_Assisted].Enabled = False
[Walk_in_Self_selected].Enabled = False
[Female].Enabled = False
[Sent_Resources].Enabled = False
[Indigenous].Enabled = False
[Male].Enabled = False
[CALD].Enabled = False
Else
[Walk_in_Assisted].Enabled = True
[Walk_in_Self_selected].Enabled = True
[Female].Enabled = True
[Sent_Resources].Enabled = True
[Indigenous].Enabled = True
[Male].Enabled = True
[CALD].Enabled = True
End If

End Sub

It can't identify the the line with this code
If [Other__info_sessions__presentations__education_etc].Value = True Then

Can someone please explain why, i copied and pasted the exact wording on the
private sub line and it still wont work
 
J

Jeanette Cunningham

EjFizzy
If [Other__info_sessions__presentations__education_etc]
is the name of a control on your form, then the syntax is like:
If Me.ControlName = True Then


If [Other__info_sessions__presentations__education_etc]
is the name of a field, then the syntax is like:
If Me![Other__info_sessions__presentations__education_etc] = True Then

Replace ControlName with your control names


I'm not sure if Walk_in_Assisted is the name of a text box on your
form or a field.
If it is a text box then do the syntax of the code as shown below.

Walk_in_Assisted.Enabled = False
Walk_in_Self_selected.Enabled = False
Female.Enabled = False
Sent_Resources.Enabled = False
Indigenous.Enabled = False
Male.Enabled = False
CALD.Enabled = False


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
E

EjFizzy

Thanks Jeanette. I tried a few different ways and still cant get it to work
any more suggestions???

Jeanette Cunningham said:
EjFizzy
If [Other__info_sessions__presentations__education_etc]
is the name of a control on your form, then the syntax is like:
If Me.ControlName = True Then


If [Other__info_sessions__presentations__education_etc]
is the name of a field, then the syntax is like:
If Me![Other__info_sessions__presentations__education_etc] = True Then

Replace ControlName with your control names


I'm not sure if Walk_in_Assisted is the name of a text box on your
form or a field.
If it is a text box then do the syntax of the code as shown below.

Walk_in_Assisted.Enabled = False
Walk_in_Self_selected.Enabled = False
Female.Enabled = False
Sent_Resources.Enabled = False
Indigenous.Enabled = False
Male.Enabled = False
CALD.Enabled = False


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


EjFizzy said:
I am getting this error message on a form:

Run-time error '2465':
Microsoft Office Access can't find the field '|' referred to in your
expression.

I go to Debug and this is where the error is:

Private Sub
Other__info_sessions__presentations__education_etc__AfterUpdate()
If [Other__info_sessions__presentations__education_etc].Value = True Then
[Walk_in_Assisted].Enabled = False
[Walk_in_Self_selected].Enabled = False
[Female].Enabled = False
[Sent_Resources].Enabled = False
[Indigenous].Enabled = False
[Male].Enabled = False
[CALD].Enabled = False
Else
[Walk_in_Assisted].Enabled = True
[Walk_in_Self_selected].Enabled = True
[Female].Enabled = True
[Sent_Resources].Enabled = True
[Indigenous].Enabled = True
[Male].Enabled = True
[CALD].Enabled = True
End If

End Sub

It can't identify the the line with this code
If [Other__info_sessions__presentations__education_etc].Value = True Then

Can someone please explain why, i copied and pasted the exact wording on
the
private sub line and it still wont work
 
J

Jeanette Cunningham

Would love to help, but I need a bit more info from you.
Remember that I can't see your database.
There are many possible reasons for your code not working - I don't even
know what the error is each time you try something new.
What is [Other__info_sessions__presentations__education_etc] ?
It looks like it is a control because you have an after update event name
for the name of your sub.
I need a description of what your form is trying to do.
I need the tables and their field names that are part of this form.
Is the form used for data entry, editing, for reading only, to run a report
or something else?


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


EjFizzy said:
Thanks Jeanette. I tried a few different ways and still cant get it to
work
any more suggestions???

Jeanette Cunningham said:
EjFizzy
If [Other__info_sessions__presentations__education_etc]
is the name of a control on your form, then the syntax is like:
If Me.ControlName = True Then


If [Other__info_sessions__presentations__education_etc]
is the name of a field, then the syntax is like:
If Me![Other__info_sessions__presentations__education_etc] = True Then

Replace ControlName with your control names


I'm not sure if Walk_in_Assisted is the name of a text box on your
form or a field.
If it is a text box then do the syntax of the code as shown below.

Walk_in_Assisted.Enabled = False
Walk_in_Self_selected.Enabled = False
Female.Enabled = False
Sent_Resources.Enabled = False
Indigenous.Enabled = False
Male.Enabled = False
CALD.Enabled = False


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


EjFizzy said:
I am getting this error message on a form:

Run-time error '2465':
Microsoft Office Access can't find the field '|' referred to in your
expression.

I go to Debug and this is where the error is:

Private Sub
Other__info_sessions__presentations__education_etc__AfterUpdate()
If [Other__info_sessions__presentations__education_etc].Value = True
Then
[Walk_in_Assisted].Enabled = False
[Walk_in_Self_selected].Enabled = False
[Female].Enabled = False
[Sent_Resources].Enabled = False
[Indigenous].Enabled = False
[Male].Enabled = False
[CALD].Enabled = False
Else
[Walk_in_Assisted].Enabled = True
[Walk_in_Self_selected].Enabled = True
[Female].Enabled = True
[Sent_Resources].Enabled = True
[Indigenous].Enabled = True
[Male].Enabled = True
[CALD].Enabled = True
End If

End Sub

It can't identify the the line with this code
If [Other__info_sessions__presentations__education_etc].Value = True
Then

Can someone please explain why, i copied and pasted the exact wording
on
the
private sub line and it still wont work
 

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

Similar Threads


Top