Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2005, 03:25 PM
Registered User
 
Join Date: Mar 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Simple AfterInsert() question

Hey all - I have a form with several fields. After filling all the fields for one record, I click the Right arrow automatically provided by Access to add that record and go to a new one. The cursor does not go back to the top, so I added the following code:
Private Sub Form_AfterInsert()
facName.SetFocus
End Sub

While that sets the focus to the correct field at the top of the form, it no longer takes me to a new, blank record. Some help please.
Thank you,
Nora

 
Old March 28th, 2005, 07:53 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Change the tab index of your controls.
The lowest indexed control is automatically the first one that has the focus when you move to a record, and when you move to the next control from the control with the highest index, the next record is selected (a new record in data entry, or if the record you are leaving is the last record in the table or is a new one) provided that you have the options set to cycle through records, rather than cycling through the controls.

When you create a form, the controls are given sequential tab indices by the order in which you add them to the form.

On the View menu, there is a Tab Order selection which gives you a really nice means of adjusting the indices in a really helpful drag-N-drop dialog.





Similar Threads
Thread Thread Starter Forum Replies Last Post
not at all simple question petergoodman XSLT 0 July 18th, 2008 08:37 AM
very simple question rogdawg Visual Studio 2005 2 January 14th, 2008 04:03 PM
Very Simple Question YoungLuke C# 2 May 4th, 2007 02:23 AM
Simple Question ironchef Java GUI 0 September 14th, 2006 04:56 PM
Simple Question dinosaur_uk VB.NET 2002/2003 Basics 1 September 10th, 2004 09:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.