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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Form programming - on click how open new form

Status
Not open for further replies.

parodytx

Technical User
Sep 12, 2006
6
US
MS Access 2003 Win XP Pro SP2

Please help with the programming required to navigate between forms. I have a main form with an option box containing choices. Each choice is supposed to open a new form, that may have similar boxes opening additional forms of its own.

When I change the properties of the first option button, "on click" is not available as an event, only "got focus." If I program the Got Focus event to open the new form, when I navigate to the main form the first time it pops to the child form from button 1. I made sure there is no default choice selected on the option box.

I want the main form to stay open, and on clicking the option button to navigate to the child form. Another acceptable option would be to select the choice and then click a "GO" button control.

Any help with the code would be appreciated.

Thanks.
 
parodytx
Are you sure the Properties for the option button don't include Click? It should definitely be there.

In Design view, Right click on the option button itself (not on the label) and check the Properties. Click has to be there.

Your other alternative would be to go from the Main form to other forms using command buttons. You can use the command button Wizard to do the programming work for you.

Tom
 
In design mode, the properties on the Option button under the Event Tab are: On Got Focus, On Lost Focus, on Mouse Down, on Mouse up, etc. Nothing with On Click or otherwise.

hwb
 
hwb
Well, that doesn't make much sense. Unless, possibly, something isn't installed properly.

Try this...
Create a new "unbound" form - without it being tied to any table or query. Still in Design View, put an Option button on it and check the Properties to see if OnClick, OnDoubleClick, etc., are there.
You don't have to save the form. It's just a test.

Tom

 
Tom,

Perhaps my terminology was unclear. What I am describing is an Option Group, with the labels being pulled out of a table.

Tried your test - the option BUTTON has an On Click event. The Option Group button(s) does not, only the Got Focus.

If you put a bunch of Option Buttons in a row, will they be mutually exclusive of each other? Do you group them? Or should I just stick with the multiple Command Button suggestion?

hwb
 
hwb
Yep, there's a difference between an Option button and an Option Group.

The buttons are all attached to the same group, but they are mutually exclusive.

One way to do it is to use the Option Group Wizard to set up the group. Then put code on the OnClick event for the Group, using Select Case statements in the code behind the Click event.

For example,
Code:
Private Sub YourFrameName_Click()
Select Case YourFrameName
Case Is = 1
DoCmd.OpenForm "Form1"
Case Is = 2
DoCmd.OpenForm "Form2"
Case Is = 3
DoCmd.OpenForm "Form3"
End Select
End Sub

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top