Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Group/Boxes and using them to open or close forms

Status
Not open for further replies.

Myvee

Programmer
Mar 22, 2006
12
CA
Hello Again! I am wondering if anyone happens to know how to use an option group with a command button to open and close forms. I would like to do the following, but I'm not 100% sure how to do this.
The option group has three options - 1. Perform another inspection, 2. Return to Main Menu and 3. Exit the database. Once the user selects their option, they will click an "OK" button to perform the action required. So for option 1, pressing Ok will close the dialog box they are in, and open another form. Option 2 will close the dialog box and open the main menu form and Option 3 will quit the database all together.
Any suggestions would be greatly appreciated.
Thankyou, Myvee
 
on your command button's click event find out which option has been selected, then execute the commands.

Im assuming you gave your options appropriate names, such as optInspection, optMainMenu, optExit, and I'm assuming that you have the functionality of the option buttons working correctly (when one is selected, the others aren't). Then you can just go into the VBA code, and create a sub routine for the command button's click event, and put something LIKE:

If optInspection Then
DoCmd.Close
DoCmd.OpenForm "nameofform"
ElseIf optMainMenu Then
DoCmd.Close
DoCmd.OpenForm "nameofmainmenu"
Else
DoCmd.Exit
End If

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top