From: (PeteCresswell) on
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?
--
PeteCresswell
From: Douglas J. Steele on
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!

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"(PeteCresswell)" <x(a)y.Invalid> wrote in message
news:shd6s5l5c65pfhia2o42tgd2s214f29887(a)4ax.com...
> 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?
> --
> PeteCresswell


From: (PeteCresswell) on
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.


--
PeteCresswell
From: David W. Fenton on
"Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote in
news:OE6E9Im2KHA.4016(a)TK2MSFTNGP05.phx.gbl:

> You can't use Me in the immediate window.
>
> You have to use ?Forms!NameOfForm!optWhichSheets.Name

You *can* use Me if you're in break mode.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
From: David W. Fenton on
"(PeteCresswell)" <x(a)y.Invalid> wrote in
news:9mo6s55jqp7rmkocadon3h50mog60937lm(a)4ax.com:

> 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.

Have you tested:

?Forms!NameOfForm.Name

....and:

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

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

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 |  Next  |  Last
Pages: 1 2
Prev: Dane :
Next: tables not linking properly