Loop through the documents in Forms : Forms « Forms « VBA / Excel / Access / Word






Loop through the documents in Forms

 
Sub exaFormsContainer()
 
    Dim db As Database
    Dim frm As Form
    Dim doc As Document
     
    Set db = CurrentDb
     
    Debug.Print "Opened form count: " & Forms.Count
    For Each frm In Forms
       Debug.Print frm.Name
    Next
    Debug.Print
     
    Debug.Print "Saved form count: " & db.Containers!Forms.Documents.Count
    For Each doc In db.Containers!Forms.Documents
       Debug.Print doc.Name
    Next
     
End Sub

 








Related examples in the same category

1.Use the form object variable to point at each form in the Forms collection