Access 2007 Run-time Error 2467 when accessing a listbox value on a sub form

K

kengelhardt

I have a database that has been in production on Access 2003 for quite
some time and has run without errors.

A user's machine was recently upgraded to Access 2007 and now the
database throughs a Run-time Error 2467 "The Expression you entered
referes to an object that is closed or does not exist" on the
following line that references a listbox value on a sub form.

If Nz(Me.sfrm_Consultant_Contract_Request.Form.Cmb_Consultant.Value) =
"" Then
..
..
..

I changed the code to

If Nz(Forms!
frm_Main.sfrm_Consultant_Contract_Request.Form.Cmb_Consultant.Value) =
"" Then
..
..
..

and still get the same error. Both verisions of the code work fine in
Access 2003.

Anyone have a solution or an idea why the object reference chokes in
Access 2007?

Thanks in advance.

Keith E.
 
D

Douglas J. Steele

I believe Access 2007 is a little stickier about syntax.

See whether

Me!sfrm_Consultant_Contract_Request.Form!Cmb_Consultant.Value

or

Forms!frm_Main!sfrm_Consultant_Contract_Request.Form!Cmb_Consultant

work any better.
 
K

kengelhardt

I still get the same error.

The subform is on a tab control. Maybe I need to nest through it's
object reference down to th esub form.

Re: > I believe Access 2007 is a little stickier about syntax.

Why would MS break older version code ny not recognizing what used to
be valid syntax. Frustrating!

Keith E.
 
D

Douglas J. Steele

No reference to the tab is required. Are you sure that the name of the
subform control on the parent form is the same as the form being used as the
subform? It's the subform control you have to reference.

Just because Access used to recognize sloppy syntax doesn't mean they're
obligated to do so for ever. Technically, in VBA ! (bang) is supposed to be
used for user-defined items (such as controls on forms), while . (dot) is
used for items defined by Access (such as properties).
 
K

kengelhardt

Thanks for the response.

Good to hear the no reference to the tab control is not necessary.

I am sure that the name of the subform control on the parent form is
the same as the form being used as the
subform. This was confirmed by another developer on my team, just as a
reality check.

However, I noticed that the subform is not being displayed on its tab
in Access 2007. But, it is in Access 2003.
So, I suspect since it is not visible on the tab control, it isn't
present to be referenced by the code. Yet I have no clue why this
particular form is not being displayed on its tab. All other subforms
appear on their appropriate tabs in MS Access 2007 and there are no
issues with any of the tabs and subforms in MS Access 2003.

Keith E.
 
K

kengelhardt

I recreated the form and it worked for a few tests and the somehow got
corrupted when I changed the column count for the list box. so, I am
back to square one with the same error. Is there some reason why this
would effect running the form on MS 2007?

Keith E.
 

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

Top