By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,882 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,882 IT Pros & Developers. It's quick & easy.

Access form/subform: On data entry, new record entry will not begin at first tab fiel

P: 20
When Access db is first opened and the first record is entered, tabbing on subform works properly. However, when subsequent records are entered, the subform retains memory of the last field filled in prior record and drops to this field once data is filled in main form. So, if I tab across the main form and expect the first field of the subform to follow, I am disappointed. Cannot figure out how to ensure that after saving a record the tabbing history is cleared and tabbing starts again with the first field. I am not a programmer so any help you can give me will be appreciated.
Sep 9 '10 #1

✓ answered by Stewart Ross

I'm assuming that the Tab Order for your subform is set correctly, which you can check in design view by selecting View, Tab order. If not, then move the control you want to be first to the top of the list in the tab order sheet.

If there is no problem with the tab order then you will need to do a little programming to ensure that the first subform control always has the focus when moving from record to record, but this is not difficult.

Open the subform in design view, and in the form's property tabs select the Event tab. Scroll to the On Current event. If it is blank, as I would expect it to be, click in the blank area to select it, then click on the builder button (the one with three dots that appears to the right of the blank box) and select Code Builder. This creates a skeleton of the On Current event for your form.

In the On Current event, enter the following expression, changing the name of the control to whichever one is the one on your form that you want to be filled in first:

Expand|Select|Wrap|Line Numbers
  1. Me![Name of your control].SetFocus
Save the code page, close the VBE editor, then tryout the form.

The On Current event is triggered each time you move from record to record. What is shown above should set the focus onto whatever control you want to be shown first, regardless of what the last control was before you moved to a new record.

-Stewart

Share this Question
Share on Google+
2 Replies


Expert Mod 2.5K+
P: 2,545
I'm assuming that the Tab Order for your subform is set correctly, which you can check in design view by selecting View, Tab order. If not, then move the control you want to be first to the top of the list in the tab order sheet.

If there is no problem with the tab order then you will need to do a little programming to ensure that the first subform control always has the focus when moving from record to record, but this is not difficult.

Open the subform in design view, and in the form's property tabs select the Event tab. Scroll to the On Current event. If it is blank, as I would expect it to be, click in the blank area to select it, then click on the builder button (the one with three dots that appears to the right of the blank box) and select Code Builder. This creates a skeleton of the On Current event for your form.

In the On Current event, enter the following expression, changing the name of the control to whichever one is the one on your form that you want to be filled in first:

Expand|Select|Wrap|Line Numbers
  1. Me![Name of your control].SetFocus
Save the code page, close the VBE editor, then tryout the form.

The On Current event is triggered each time you move from record to record. What is shown above should set the focus onto whatever control you want to be shown first, regardless of what the last control was before you moved to a new record.

-Stewart
Sep 11 '10 #2

P: 20
Thanks for your help. Hope to take VBA instruction soon to enable greater utility with Access. Thanks again.

cambar
Sep 11 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.