VBA Code needed

G

Garret

Right click each option button and go to 'Build Event' and then select
Code Builder in the window.
Simply type:

Docmd.OpenForm "FormNameHere"

Make sure this procedure is under the option button_click event (it
should be automatically)
 
V

Van T. Dinh

I am guessing that you are using an OptionFrame (a rectangle) with 4 options
inside. In this case, the OptionFrame has the numeric value of the Option
selected, usually from 1 to 4 in your case.

In the DesignView of the Form, select each Option and check the value
assigned. You can then use the OptionFrame_AfterUpdate Event with a simple
Case statement to open the appropriate Form. The code should be some thing
like:

Select Case Me.OptionFrame
Case 1
DoCmd.OpenForm "Form1"
Case 2
DoCmd.OpenForm "Form2"
Case 3
DoCmd.OpenForm "Form3"
Case 4
DoCmd.OpenForm "Form1"
End Select
DoCmd.Close acForm, Me.Name ' If you want to close the current Form.
 
K

Khalil

Hi,
I have a database about my family. In a form "frmPersonal" their is an
option group that containes four option buttons:
Single
Married
Devorced
Dead
(No default value is selected)

I want to use VBA Code so that:
1- When I click on "Single" a form named "frmSingle" apear and I fill in
information.
2- When I click on "Married" a form named "frmMarriage" apear and I fill in
the required information like date of marriagr and spouse name....
3- the same thing goes for "devorced" and "Dead"

Can Any one help with the VBA Code?
Thank you in advance
Khalil
 

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