Prev: Dane :
Next: tables not linking properly
From: (PeteCresswell) on 12 Apr 2010 11:08 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 12 Apr 2010 13:04 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 12 Apr 2010 14:17 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 12 Apr 2010 14:32 "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 13 Apr 2010 15:25
"(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/ |