PDA

View Full Version : Record navigation in a child form



mud2
08-25-2008, 08:24 PM
Hello, it's been a ling time but I'm still trying!
I have a MAIN form, and a subform whose sourceobject is chosen from a combobox in the main form. Now I want to navigate through the records in the subform using navigation buttons in the main form.
How??
Thanks!

CreganTur
08-26-2008, 05:48 AM
Now I want to navigate through the records in the subform using navigation buttons in the main form.
I'm not sure if this is possible. Notice that the subform does have its own navigation buttons. Is it an option for you to hide the navigation buttons on the main form, so that the User isn't confused about which ones to use?

Another option is to hide both navigation buttons, and create some command buttons that serve as your subform navigation buttons.

mud2
08-29-2008, 07:15 PM
Thanks CreganTur..."but"
Prior to going "all the way", I'm just trying to click on one command button from another, both on the same form.
The command buttgon I want to click on is Cmd1. It does a simple thing like popping a Msgbox.
I put a command button, Cmd2 on the same form, and want that when I click on Cmd2, it clicks on Cmd1. The programming under Cmd2 is:
Me.Cmd1. ...WHAT? None of the popup choices produces a Click on Cmd1. When (and if) I get this straighteened out, then I'll go to a subform...but first, simple things first!

Mavyak
08-29-2008, 09:12 PM
Me.Cmd1_Click

mud2
08-30-2008, 12:34 AM
Thank you mavyak. Now apply to a subform called child5: The control on the child form is command6.
me.child5.Form!Command6_click does not work. neither do any of the zillion variations! Do you know of the zillionth +1...that does work?
Summary: to click on a control button in a subform by clicking on a button in the parent?

Carl A
08-30-2008, 07:06 AM
Your subform has to have the focus. In the click event of the parent form set the focus to the subform and proceed.

HTH

mud2
08-30-2008, 09:54 AM
Thank you carl A. now i have a zillion + 1 ways that don't work! Every time I get "close" to executing, an error message comes up saying this process is not supported.

Carl A
08-30-2008, 10:16 AM
From the help files!

You can use the SetFocus method to move the focus to a subform (subform: A form contained within another form or a report.), which is a type of control. You can also move the focus to a control on a subform by using the SetFocus method twice, moving the focus first to the subform and then to the control on the subform.

mud2
08-30-2008, 10:28 AM
Thanks carl A. I did setfocus to the form, then to the control. Now a zillion + 2 ways that don't work!
And yet when I do get into the subform, I CAN execute command6.name!

Mavyak
08-30-2008, 11:40 AM
Have you tried:
command6_Click

Carl A
08-30-2008, 01:22 PM
After you set focus to your command6 control in its onFocus event use command6_Click

Me.child5.SetFocus
Me.child5.Form.Command6.SetFocus

Private Sub Command6_GotFocus()
Command6_Click
End Sub

mud2
08-30-2008, 06:44 PM
I've tried! Even went through a bunch of mickey mouse...cant setfocus to a form that has visible, enabled contrils. So I enabled = false and visible = false for all the child forms controls...ACCESS STILL says it cannot set focus! ...And ACCESS'S built in Help freezes up my conputer!

mud2
08-31-2008, 04:18 PM
Finally something "works"!
When I changed the "Private" to "Public" in my reference to the command button in the child form...Guess what!
The table under the child form has 5 records. When the command to go to the last record (command6) in the child form was clicked by a button in the parent form, the table under the parent form went to the 5th record! Amazing, since there is NO table under the parent form!
Since I am almost 83 years old, I give up! I'll do it the easy way and have each child form have its own record navigation buttons!