How to get the keyboard-tab key to go next Page on a tab-control f

J

Jimbo213

I have a form with tab-control. It now has five "pages" using Access
Terminology [I thought they were called tabs, but oh well...]

When the keyboard-tab key is pressed it goes through all the fields on page<1>
At the last field, press tab again and it goes back to field1 on page<1>.

How can I get the keyboard-tab to go to field1 on page<2> ?
 
R

Rick Brandt

Jimbo213 said:
I have a form with tab-control. It now has five "pages" using Access
Terminology [I thought they were called tabs, but oh well...]

When the keyboard-tab key is pressed it goes through all the fields
on page<1> At the last field, press tab again and it goes back to
field1 on page<1>.

How can I get the keyboard-tab to go to field1 on page<2> ?

A good and simple method is to add a tiny TextBox as the last control in the
TabOrder of each page. In its GotFocus event have a line of code that sets
focus to the first control on the next TabPage. This TextBox must have its
visible property set to true so it can get focus (albeit briefly), but it
can be made so small that the user wil not be able to see it.

What is good about this method is that the user is only taken to the next
page if they leave your last control with the Enter key or the Tab key, in
other words just as if the TabOrder was doing what you wanted. Some advise
using the LostFocus or Exit event of your last control to set focus to the
first control on the next page, but that means if the user presses Shift-Tab
or clicks his mouse to go to some other control your code will circumvent
their wishes and take them someplace else.
 
J

Jimbo213

Thanks Rick - that worked real slick.

Now - I'm on the last page.
How do I jump to the first text box on the first page & next record

I created a new text box at the end of the last page.
I want to go to [CompanyBox] on page1 and the next record.

This code does jump to CompanyBox but within the same record.
=Forms!frmD7MASTER!CompanyBox.setfocus

Here's what I tried [just to show you I'm not a lazy lurker!!]
I created a macro NextRecord_Company and put it in On Got Focus
I put =Forms!frmD7MASTER!CompanyBox.setfocus in On Lost Focus
and I got the error "you can't go to the specified record. You may be at
the end of a recordset."

What will work? Thanks.

--
Thanks for your reply & assistance.
Jimbo213


Rick Brandt said:
Jimbo213 said:
I have a form with tab-control. It now has five "pages" using Access
Terminology [I thought they were called tabs, but oh well...]

When the keyboard-tab key is pressed it goes through all the fields
on page<1> At the last field, press tab again and it goes back to
field1 on page<1>.

How can I get the keyboard-tab to go to field1 on page<2> ?

A good and simple method is to add a tiny TextBox as the last control in the
TabOrder of each page. In its GotFocus event have a line of code that sets
focus to the first control on the next TabPage. This TextBox must have its
visible property set to true so it can get focus (albeit briefly), but it
can be made so small that the user wil not be able to see it.

What is good about this method is that the user is only taken to the next
page if they leave your last control with the Enter key or the Tab key, in
other words just as if the TabOrder was doing what you wanted. Some advise
using the LostFocus or Exit event of your last control to set focus to the
first control on the next page, but that means if the user presses Shift-Tab
or clicks his mouse to go to some other control your code will circumvent
their wishes and take them someplace else.
 
R

Rick Brandt

Jimbo213 said:
Thanks Rick - that worked real slick.

Now - I'm on the last page.
How do I jump to the first text box on the first page & next record

I created a new text box at the end of the last page.
I want to go to [CompanyBox] on page1 and the next record.

This code does jump to CompanyBox but within the same record.
=Forms!frmD7MASTER!CompanyBox.setfocus

Here's what I tried [just to show you I'm not a lazy lurker!!]
I created a macro NextRecord_Company and put it in On Got Focus
I put =Forms!frmD7MASTER!CompanyBox.setfocus in On Lost Focus
and I got the error "you can't go to the specified record. You may
be at the end of a recordset."

What will work? Thanks.

Sorry, I know next to nothing about doing stuff with macros. What would
work in VBA is...

Me.DesiredControl.SetFocus
DoCmd.RunCommand acCmdRecordsGoToNext
 

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

Top