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

tab order in multi-page form 1

Status
Not open for further replies.

hshaker

Technical User
Jun 29, 2007
66
CA
Hi there,

I have a form that has a multi-tabbed pages (tab control). I would like to go to next tab of the form after the last field of the first tab is finished. Instead it starts a new form.

The tab order for each tabbed page is correct but how do I go to the next page after I press the tab key.

Thanks .
 
You might try using the onlostfocus of the last form object on tab one to call the focus on tab to. I believe the code would be something like:
Code:
Me.tab2.formobject.focus

That is completely off memory so the code may not be totally legit.

"If you say you can, or you say you can't, you're right!"
-- Henry Ford
 
Instead it starts a new form.
Have a look at the Cycle property of the Form object and the SetFocus method.
Tip: to move the focus to a control in another form you must set the focus to the form prior.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It is the same form just different pages on the form (tab control)
 
Can this be done withouht vba programming?
 
You have a TabControl without a different subform in each Page ?
 
Assuming you do not subforms in each page just controls.

I found that it is slightly difficult to trap the "tab" keypress event when exiting the control because the event fires when you enter the control (not sure why). So what I do is trap the form level keyPress event and define a public variable.
Code:
public pubKeyAscii as integer

private  sub Form_keyPress(keyAscii as integer)
  pubKeyAscii = keyAscii
end sub
then for each last control on a page do something like
Code:
private sub text3_Exit(cancel as integer)
  if pubKeyAscii = 9 then
   me.controlNameOnNextPage.setfocus
end sub
 
I explain again.

I have a form called "X" it has a tab control object which has many pages. In each page, there are obviously some fields (ie text fields, combo boxes, commands etc..)

After I press the tab key for the last field, it goes to next record instead of going to the next page of the tab control.

Hope this makes sense?

 
What is the value of the Cycle property of the Form ?
 
I can tell you I think I am working on a very similar database. I have total of 7 subforms and I want to fill out the answers on one subform, and then have it go to the next subform, but with the same related record when I do so. I did get that working ok, and basically, all I did was put the following code in the last check box:

Private Sub Check26_LostFocus()
DoCmd.GoToControl "Page3"
End Sub

But, I do have a new problem. I was asked to add another field, and that worked fine to a point, as long as I entered new check boxes (as opposed to simply copying them from one form to another). But, once I set the tab order, it messed up the "sychronization" of one form to another, and goes back to opening a new record like you mentioned. If I figure that out, I will let you know.
 
MightyPup, as PHV mentioned, check out the Cycle property of your form - it should be 'Current Record' if you don't want to cycle between records.

Max Hugen
Australia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top