Alternative forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

It may be easier if I describe what I'm trying to do!
I need to create a mechanism, whereby I can ask the user if he wants option
A or option B. If he/she selects A, then the user is presented with Form A.
If he selects B, then he is presented with Form B.
Would anybody know how to do this?

Many thanks in advance

Phil
 
1) Create a new form called "frmMain" (or whatever you want to call it)
and go into Design view.
2) Use the toolbar to create two command buttons. Cancel the wizard if
it pops up. Right click on each command button and go to Properties.
Change the names to "cmdOpenFormA" and "cmdOpenFormB". Change the
captions to "Open Form A" and "Open Form B" respectively.
3) Go to the View>Code. The Microsoft Visual Basic Editor should open.
4) Paste the following code in the main code window under "Option
Compare Database"

Private Sub cmdOpenFormA_Click()

DoCmd.OpenForm "Form A"

End Sub


Private Sub cmdOpenFormB_Click()

DoCmd.OpenForm "Form B"

End Sub

5) Save the code. Close the Microsoft Visual Basic Editor.
6) Run the form and test the buttons. They should open your forms.
 
Many thanks!

KML said:
1) Create a new form called "frmMain" (or whatever you want to call it)
and go into Design view.
2) Use the toolbar to create two command buttons. Cancel the wizard if
it pops up. Right click on each command button and go to Properties.
Change the names to "cmdOpenFormA" and "cmdOpenFormB". Change the
captions to "Open Form A" and "Open Form B" respectively.
3) Go to the View>Code. The Microsoft Visual Basic Editor should open.
4) Paste the following code in the main code window under "Option
Compare Database"

Private Sub cmdOpenFormA_Click()

DoCmd.OpenForm "Form A"

End Sub


Private Sub cmdOpenFormB_Click()

DoCmd.OpenForm "Form B"

End Sub

5) Save the code. Close the Microsoft Visual Basic Editor.
6) Run the form and test the buttons. They should open your forms.
 

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

Back
Top