Microsoft KB Archive/210336

= ACC2000: Sample Function to Determine Current Page of a Form =

Article ID: 210336

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210336



Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
This article shows you how to create a sample, user-defined function that you can use on a multiple-page form that contains page breaks to determine which page of the form is current.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following steps demonstrate how to create and use the sample function WhichPage:  Open the sample database Northwind.mdb. Open the Employees (page break) form in Design view. Set the EmployeeID control's OnDblClick property to =WhichPage(Form,[EmployeeID]) . For the EmployeeID control, set the Enabled property to Yes and the Locked property to No. Set the Address control's OnDblClick property to =WhichPage(Form,[Address]). Save and then close the form.  Create a module and type the following lines in the Declarations section if they are not already there: Option Compare Database Option Explicit </li>  Type the following procedure: Function WhichPage (F As Form, MyControl As Control) Dim Page, I As Integer Dim C As Control Page = 1

For I = 1 To F.Count - 1 Set C = F(I) If TypeOf C Is PageBreak Then If C.Top < MyControl.Top Then Page = Page + 1 End If  Next I

MsgBox "Page= " & Page End Function </li> Close the module and save it as Module Test.</li> Open the Employees (page break) form in Form view. Double-click the EmployeeID field, and then the Address field. Note that the function displays the number of the page containing the control.</li></ol>

Additional query words: inf

Keywords: kbhowto kbprogramming KB210336

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.