Automatically opening a form

  • Thread starter Thread starter David Portwood
  • Start date Start date
D

David Portwood

The Access 2K text I'm reading says the following should work:

Form_MyFormName.PublicVar = "New Caption"
Forms!MyFormName.visible = True

The text says that even if MyFormName is not loaded, this syntax will load
the form hidden and then make it visible.

Well, when the form is not open, it does automatically load the form hidden.
However, the second statement blows up. Error message says it can't find
"MyFormName". But it definitely is loaded hidden. I can unhide it manually.

Is the text wrong? Am I doing something wrong?
 
I've never opened a form that way. What's wrong with:

DoCmd.OpenForm "MyFormName"

To open hidden try:

DoCmd.OpenForm "MyFormName", , , , , acHidden
 
If all I wanted to do was open a form, I would do it using a simple
DoCmd.OpenForm statement. What I'm trying to do here is reference a public
variable on another form. When I do this, using the syntax provided, it is
supposed to automatically open the form containing the public variable.

Access does open the form hidden, but when I try to make it visible (as
mentioned in my first post) the .Visible statement blows up. My textbook
says that shouldn't happen. Wondered if anyone might know anything about
this.
 
Back
Top