MrGibbage
MrGibbage

Reputation: 2646

MS Access error 2424 Cannot find object

I have what looks like a very straightforward line of VBA code that is really messing with my head.

id = Form_frm2013_Browser.tb_LineItem_ID.value

When my code reaches this point, I get the following error:

Run-time error '2424': The expression you entered has a field, control, or property name that Microsoft Access can't find

I am pretty sure the problem is the lower-case "v" in value. When I use the intellisense code completion, the property "Value" comes up as upper case, but when I press enter, it goes to lower case. Of course manually attempting to change it doesn't work either--it just goes back to lower case.

By the way, tb_LineItem_ID is the name of a text box control.

Any idea what is going on here?

Upvotes: 2

Views: 10410

Answers (2)

Smart.Man
Smart.Man

Reputation: 41

For me, The control had to be enabled first.

n.b. and do not disable it within the same sub/fun.

Upvotes: 0

HansUp
HansUp

Reputation: 97131

Access is complaining it can't find something when you ask for the value of a text box. I can't spot anything wrong in that code line, but sometimes it can be helpful to ask for what you want in a different way.

With frm2013_Browser open in Form View, go to the Immediate window (Ctrl+g), and see what you get with this statement.

Debug.Print Forms!frm2013_Browser!tb_LineItem_ID.value

Upvotes: 3

Related Questions