how do i move from tab to tab (or is it page to page) in a subform

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

Guest

Hi. I have a form with a subform. The subform has a Tab Control with 8 tabs
and a different subform on each page/tab. when I get to the last field of
one page/tab I would like to go to the first field on the next page/tab. How
do I do this? I am using Access 2003. I should not that I do not program
nor know how to use macros so a detailed answer would be very much
appreciated. thanks
 
Here's one way to do this assuming that the subforms are never used outside
of the main form:

In design view of the main form, create a new procedure:
Menu - View - Code
A new window will open (Microsoft Visual Basic...)
In the VB window, go to:
Menu - Insert - Procedure (Sub & Public)
Give it a name like "Move2Sub1"
Two lines of code will be created for you, add another one in between:

Public Sub Move2Sub1()

DoCmd.GoToControl Me.SubForm1

End Sub

When you type "Me.", a list will appear. Select the one that corresponds to
the subform control's name. The subform control's name can be found by
selecting the subform in the main form in design mode and looking at the
subform properties. You'll have to do this for each subform. IOW, you'll
create 8 public procedures that move to a specific subform.

In a subform, create a procedure that is triggered by the last control's
AfterUpdate event:
Open the subform in design mode and select the last control (textbox) where
you want the focus to move to the next subform.
Open the properties window of the control (the icon looks like a finger
pointing at a list).
In the Event tab, select [Event Procedure] in the row After Update.
Click on the ... button at the end of the line and the VB window will open.
Two lines will be automatically created for you. In between those two lines,
enter:

Forms!MainFormName.Move2Sub1

Replace MainFormName with the actual name of the main form, and replace
Move2Sub1 with the appropriate procedure you created in part one. For
example, if this is the last control of the second subform and you want to
move the third subform, the procedure might be Move2Sub3.
You'll have to do this for every subform.
HTH
 

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