Run Time Error 2465 cant find the field "fieldname" referred in your expression

JMarcus

Registered User.
Local time
Today, 10:28
Joined
Mar 30, 2016
Messages
89
Run Time Error 2465 cant find the field "fieldname" referred in your expression

Anyone know the solution to the following on a field on a form:

Once field is clicked, pop up message: Run Time Error 2465 cant find the field review_date 2 referred in your expression.

The debug brings you right to the following:

Me!review_date2.SelStart = 0

The only difference I see in the nameing is the name of the field is actually called "review date2" not "review_date2" but it should still be OK.

Naming and Source with the events match. Doesnt look like the field is referred to anywhere else on the form. The only difference is the "

Any help, would be great. Thanks
 
Re: Run Time Error 2465 cant find the field "fieldname" referred in your expression

...but it should still be OK...

How do you figure that? Spaces should never be used in the names of things such as Fields and Controls...it confuses the Access Gnomes no end. IF you simply have to use them, when referring to them in VBA code you have to enclose them in Square Brackets. So if the Control is named review date2...with the space, you should be using

Me.[review date2].SelStart = 0

Linq ;0)>
 
Re: Run Time Error 2465 cant find the field "fieldname" referred in your expression

Thanks. I inherited the database this is how it was developed. I should remove the "_" in the code and just put it in brackets.
 
Re: Run Time Error 2465 cant find the field "fieldname" referred in your expression

It worked. Thanks.

Private Sub review_date2_Click()
' select entier field

Me![review date2].SelStart = 0

End Sub
 
Re: Run Time Error 2465 cant find the field "fieldname" referred in your expression

Glad we could help!

Inheritance can be a $%^&*!

Linq ;0)>
 
Re: Run Time Error 2465 cant find the field "fieldname" referred in your expression

you need the [] square brackets when there is a space in a field name.
you can't replace a space with an underscore. an underscore is a different character.

you may also need square brackets if a field has a reserved name.

eg, a field called "date" may conflict with the function date

rst![date] should avoid the problem, but use of reserved words is best avoided, but occasionally missed. Clearly it's not illegal otherwise access would not permit it.
 

Users who are viewing this thread

Back
Top Bottom