Loading and Unloading forms

  • Thread starter Thread starter SDH
  • Start date Start date
S

SDH

I am using a "switchboard" - a form carrying a number of buttons - as
a menuing device to enable the user to navigate around an application,
each button opening a form, another "sub switchboard" giving further
choices, or a report.

I want the "switchboard" itself to close when the user makes a choice,
to avoid clutter on the screen (and, in theory at least, to conserve
resources). There are "return to main menu" buttons on each form,
which should, again, close that form and take the user back to base.

I have tried putting:

Unload fmSwitchboard

behind the button (both before and after the code inserted by the
"Wizard"), but keep getting the error message "Object required". Same
with "Load fmSomething"

but isn't a form an object?

The Wizards use the more verbose "DoCmd ..." syntax, rather than
simply "Load" .

I get the same message with "Show.fmThisOne" and "Hide.fmThatOne".

I have had no problesms usuing all four statements/commands with Excel
and Word applications using VBA. Is Access somehow different?

What am I missing?

Many thanks in advance for any comments

David
 
Try this --

Private Sub cmdAnotherForm_Click()
DoCmd.OpenForm "frmAnother"
DoCmd.Close acForm, "frmSwitchboard"
End Sub

You will have similar coding on other Buttons as you
move from Form-to-Form.

HTH - Bob
 
Back
Top