Loading and Unloading forms

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
 
B

Bob Barnes

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
 

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