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 acting strangely...

Status
Not open for further replies.

PaulChilds

Technical User
May 21, 2002
195
Hi,

I've made a very basic datbase to keep a track of sheet music. In the form 'Song' I can enter the fields 'First Line', 'Song Title', 'Copyright Info' & 'Book Number' and then this is where the fun starts...

I tab into a subform called Authors, which is broken into three fields - 'First Name', 'Surname' and then a hidden autonumber called 'Key'. However, when I tab from 'Book Number' into the Authors subform, the cursor jumps into the 'Surname' field first. I checked the tab order in the form and the subform and they are both right. I even deleted my original database and created it again, and then again on a different computer with a different version of Access, and the problem still occurs.

Any ideas what's going on?

Paul C
 
Hi Paul,

This is a known quirk with Access subforms. If you look and check closely you will find that Access sets the focus to the subform field that last had focus the last time that the subform had focus. Try it, click in the second tab order field in subform, then click back to main form and try tabbing to subform, when you get to subform you will be returned to same field. Also notice that you can't tab out of the subform to the main form!

You need some type of hidden "sentry" or command button on the main form and subform to act as the last field in the Tab Order to have focus. In this "sentry" button, create an 'On Enter' event procedure that sets the focus to the appropriate field.

Note that this hidden "sentry" button should be Transparent but must also remain Visible to be included in the tab order! You can make the size of the button very small so users will not click it by accident.

I first saw this type of code trick in an excellent Access book by Stan Leszynski. Book was titled "Access Expert Solutions" and contained a wealth of usefull tricks! I highly recommend that serious developers/users purchase this or a similar reference book!

aflat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top