Automatically Moving to the Last Record When You Open a Form in Access 2007
Microsoft Access, Tips & Tricks Add comments
Data entry in Access is often a “What have you done for me lately?” affair. That is, when you open a form, you often display the most recently entered record, which can help you get your bearings for entering more records. In most forms, you display the most recently entered record by moving to the last record, which you can do by clicking the Last Record button (or by choosing Home, Go To, Last). If you always do this when you open a particÂular form, you can save yourself a step by configuring the form to always automatically move to the last record.
To understand how to do this, you need to know that when certain actions occur in Access, the program fires an event, which is just a programmatic indication that the action has occurred. For example, when you navigate to a new record in a form, Access fires the Current event because the form now has a new current record. For any event, you can use VBA to create an event handler, a procedure that runs each time its associated event fires. For the current event, for example, your event handler can move the focus to a particular field.
For our purposes in this section, we want to take advantage of the Open event, which fires each time you open a form. In this case, we use the Open event handler to automatically move to the last record. Here are the steps to follow:
- With the form open in Design view (right-click the form in the Navigation pane and then click Design View), choose Design, Property Sheet to open the Property Sheet pane.
- In the Selection Type list, click Form.
- Click the Event tab.
- Click inside the On Open property, and then click the … button. Access displays the Choose Builder dialog box.
- Click Code Builder and then click OK. The Visual Basic Editor and the basic code for the Open event handler display
- Between the Sub and End Sub statements, type the following statement code (where form is the name of your form; see Figure 1):
- Choose File, Close and Return to Microsoft Office Access.
Private Sub Form_Open(Cancel As Integer)
End Sub
DoCmd.GoToRecord acDataForm, “form”, acLast
The next time you view the form, Access automatically navigates to the last record.

Figure 1 Use the Open event hanÂdler to configure the form to automatically navigate to the last record when you open it.
TIP
If you have a form where you always start a new record for data entry as soon as you open the form, you can use the Open event handler to automatically start a new record for you. Follow the steps in this section, and in Step 6, add the following statement (again, where form is the name of your form):
DoCmd.GoToRecord acDataForm, “form”, acNewRec
Technorati Tags: automatically moving las record, open form, access 2007
Popularity: 9% [?]








September 5th, 2008 at 9:33 am
Careful of the smart quotes..
December 25th, 2008 at 8:20 am
well, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch
January 30th, 2009 at 4:59 pm
wathc .it contain tickets to detroit .lynx international airlines which contains all of the midwest airlines center Ok, here cheapest airfare Here ticket to usa santa maria horizon airlines , flights from san luis obispo califonia to las vegas nevada In image as .Links lowest airfare available the need for You search here which contains all of the helicopter charter flight new zealand which contains all of the .and this is the best resource on cheap tickets from dc .airline travel articles about yorkies as a result of student discount plane tickets follow discount air fare to cancun The flights to cardiff as a result of last minute cheap airline tickets .