simple can't find form question

M

Mark Kubicki

I have a form with some simple code behind it which reads like this:

with Forms![frmNextFixtureTypeOption]
.[lblNextAlpha].Caption = strNextAlpha
.[lblNextNumeric].Caption = strNextNumeric
end with

stDocName = "frmNextFixtureTypeOption"
DoCmd.OpenForm stDocName, , , stLinkCriteria

the second part (where I open the form) works fine, but the first (where I
set the caption for 2 of the controls) does not - it returns an error
"can't find form"...


as always, many thanks in advance,
mark
 
J

John W. Vinson

I have a form with some simple code behind it which reads like this:

with Forms![frmNextFixtureTypeOption]
.[lblNextAlpha].Caption = strNextAlpha
.[lblNextNumeric].Caption = strNextNumeric
end with

stDocName = "frmNextFixtureTypeOption"
DoCmd.OpenForm stDocName, , , stLinkCriteria

the second part (where I open the form) works fine, but the first (where I
set the caption for 2 of the controls) does not - it returns an error
"can't find form"...

That's because it isn't open yet. The Forms! collection contains only *OPEN*
forms.

Move the first four lines after the OpenForm event line.
 

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