dynamically remove recordsource

abenitez77

Registered User.
Local time
Today, 10:40
Joined
Apr 29, 2010
Messages
141
How can i remove all recordsources from all forms and subforms in my app? I want to do this with vba to loop thru all forms and remove all recordsources.

thanks!
 
Although he stated Forms collection, he meant the AllForms collection as per the link. The Forms collection only holds open forms.
Code:
Public Sub ModForms()
  Dim frm As Access.Form
  Dim frmObj As AccessObject
  For Each frmObj In CurrentProject.AllForms
    DoCmd.OpenForm frmObj.Name, acDesign
    Set frm = Forms(frmObj.Name)
    'do code here
    'frm.Caption = "Changed"
    DoCmd.Close acForm, frm.Name, acSavePrompt
  Next frmObj
End Sub
 

Users who are viewing this thread

Back
Top Bottom