Module: Forms_ADP in Category Microsoft Access : Forms from Total Visual SourceBook

Routines for Microsoft Access forms in Access Data Projects (ADPs) using VBA.

Microsoft Access 2013 no longer supports ADPs. This code only runs in Access 2000, 2002, 2003, 2007 and 2010.

Procedure Name Type Description
(Declarations) Declarations Declarations and private variables for the modForms_ADP module.
GetFormRecordNumberADP Procedure Get the current record number of a form in an ADP.
GetFormRecordCountADP Procedure Get the total records of a form in an ADP.
IsFormOnFirstRecordADP Procedure Determine if the current record of a form in an ADP is on the first record.
IsFormOnLasttRecordADP Procedure Determine if the current record of a form in an ADP is on the last record.
ListFillTablesADP Procedure Provides a list fill function for a list/combo box for a list of tables in an ADP database.
' Example of modForms_ADP
' Microsoft Access 2013 no longer supports ADPs. This code only runs in Access 2000, 2002, 2003, 2007 and 2010.
'
' To try this example, do the following:
' 1. Create a new form in an ADP that is connected to the 'Northwind' sample database (or another SQL Server Database that contains tables)
' 2. Set the form's RecordSource property to the 'Categories' table (or another table that contains one or more records)
' 3. Add a command button named 'cmdTest'
' 4. Add a list box named 'lstTables'
' 4. Paste this code into the form's module

Private Sub cmdTest_Click()

  ' Example of GetFormRecordNumberADP
  Debug.Print "Record number: " & GetFormRecordNumberADP(Me)

  ' Example of GetFormRecordCountADP
  Debug.Print "Record count: " & GetFormRecordCountADP(Me)

  ' Example of IsFormOnFirstRecordADP
  If IsFormOnFirstRecordADP(Me) Then
    Debug.Print "On first record"
  Else
    Debug.Print "Not on first record"
  End If

  ' Example of IsFormOnLasttRecordADP
  If IsFormOnLasttRecordADP(Me) Then
    Debug.Print "On last record"
  Else
    Debug.Print "Not on last record"
  End If

End Sub

Private Sub Form_Open(Cancel As Integer)
  lstTables.RowSourceType = "ListFillTablesADP"
  cmdTest.Caption = "Test ADP Form"
End Sub

Total Visual SourceBook The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!

Additional Resources

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!


View all FMS products for Microsoft Access All Our Microsoft Access Products

Reviews

Reader Choice Award for MS Access Source Code Library
Reader Choice

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

SourceBook Info

Additional Info

Question

 

 

Free Product Catalog from FMS