ACC: How to Create Custom Navigation (VCR) Buttons on a FormLast reviewed: May 14, 1997Article ID: Q104683 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. The navigation (VCR) buttons that appear on a form's horizontal scroll bar provide a convenient way of navigating among records. The following information describes how to create custom navigation buttons on your own forms. This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x, or the "Building Applications" manual in version 2.0.
MORE INFORMATIONThe following sample module demonstrates Access Basic functions that can be used to create custom buttons for navigating among first, last, previous, and next records on a form. Functions are provided to navigate through forms as well as subforms. To create custom navigation buttons on a form, create a new module with the following Access Basic code:
'******************************************* ' MODULE DECLARATION SECTION '******************************************* Option Explicit Dim RetVal As Variant '******************************************* ' MODULE FUNCTIONS '******************************************* Function GotoFirstRecord () RetVal = GotoRecord(A_FIRST) End Function Function GotoLastRecord () RetVal = GotoRecord(A_LAST) End Function Function GotoNextRecord () RetVal = GotoRecord(A_NEXT) End Function Function GotoPrevRecord () RetVal = GotoRecord(A_PREVIOUS) End Function Function GotoFirstSubRecord (SubControlName As String) DoCmd GoToControl SubControlName RetVal = GotoFirstRecord() End Function Function GotoLastSubRecord (SubControlName As String) DoCmd GoToControl SubControlName RetVal = GotoLastRecord() End Function Function GotoNextSubRecord (SubControlName As String) DoCmd GoToControl SubControlName RetVal = GotoNextRecord() End Function Function GotoPrevSubRecord (SubControlName As String) DoCmd GoToControl SubControlName RetVal = GotoPrevRecord() End Function Function GotoRecord (Direction) On Error Resume Next DoCmd GoToRecord , , Direction End Function How to Use the Custom Navigation Functions on a FormThe steps listed below demonstrate how to use the Access Basic functions detailed above to add custom navigation buttons to the Orders and the Orders Subform forms in the sample database NWIND.MDB included with Microsoft Access:
|
Additional query words: scrollbar navigate goto
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |