Option Group, Unbound Form: 2467 Object closed or doesn't exist?

P

(PeteCresswell)

I'm getting a run-time error 2467 "The expression you entered
refers to an object that is closed or doesn't exist" when I try
to do a "?Me.optWhichSheets.Name" in the Immediate window.

What puzzles me is that "optWhichSheets" appears in the
auto-completion drop down - so it seems like there is no
name/spelling issue.

FWIW, the form is unbound - just a specification solicitation
dialog that front-ends a report.

I've got another form with a similar scheme of things (i.e. form
section in which the control is placed, block of code in which it
is referenced) that works.

Can anybody shed some light?
 
D

Douglas J. Steele

You can't use Me in the immediate window.

You have to use ?Forms!NameOfForm!optWhichSheets.Name

No idea why autocomplete would have worked for you!
 
P

(PeteCresswell)

Per Douglas J. Steele:
You can't use Me in the immediate window.

You have to use ?Forms!NameOfForm!optWhichSheets.Name

I should have added that I am in the form's code - paused at he
critical line - so the VBA environment knows about everything on
the form.

e.g.
2990 MarketValueChanges_Spreadsheet_Create mPrintMode,
Me.optWhichSheets.Value

Even without pausing/Immediate, the code throws the 2467 error.
 
D

David W. Fenton

Per Douglas J. Steele:

I should have added that I am in the form's code - paused at he
critical line - so the VBA environment knows about everything on
the form.

e.g.
2990 MarketValueChanges_Spreadsheet_Create mPrintMode,
Me.optWhichSheets.Value

Even without pausing/Immediate, the code throws the 2467 error.

Have you tested:

?Forms!NameOfForm.Name

....and:

?Forms!NameOfForm.Controls("optWhichSheets").Name

Is it by chance a subform and not a main form?
 
P

(PeteCresswell)

Per David W. Fenton:
Is it by chance a subform and not a main form?

Worse than that.

About twenty lines of code above the problem line Yours Truly had
closed the form.

Was planning on keeping my head down and my mouth shut.... but
since you asked.... -)
 
D

David W. Fenton

Per David W. Fenton:

Worse than that.

About twenty lines of code above the problem line Yours Truly had
closed the form.

Was planning on keeping my head down and my mouth shut.... but
since you asked.... -)

Those error messages tend to tell the truth, it's just not always
clear what context in which they are reporting the truth.

Don't be embarrassed -- I call this one of those "is it plugged in?"
problems. You have to ask about the basics before you waste time on
higher-level explanations of the problem, and no matter what level
you're at, even an advanced Access guru like yourself, you can still
very easily make this kind of elementary mistake.

I make dozens of such stupid mistakes every day.

Don't tell anyone!
 
P

(PeteCresswell)

Per David W. Fenton:
I make dozens of such stupid mistakes every day.

That's what I love about being a developer: make a mistake? Just
fix it and recompile.

I spent a lot of years working with engineers in an electric
utility. Make a mistake? Pour nine yards of concrete and then
find out it's 3" too deep? Whew....!!!!
 
D

David W. Fenton

I spent a lot of years working with engineers in an electric
utility. Make a mistake? Pour nine yards of concrete and then
find out it's 3" too deep? Whew....!!!!

Surely 3" too deep is not as much of a problem as 3" too shallow...
 

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