Kayleigh
Member
- Local time
- Today, 19:20
- Joined
- Sep 24, 2020
- Messages
- 709
Hi its me again!
I'm looking to iterate through all forms to find where a specific field is located. I have the code below to iterate through controls but couldn't find the required property to check the controlSource. Can anyone help me with this?
I'm looking to iterate through all forms to find where a specific field is located. I have the code below to iterate through controls but couldn't find the required property to check the controlSource. Can anyone help me with this?
Code:
Dim aO As AccessObject
Dim fm As Access.Form
Dim ct As Access.Control
For Each aO In CurrentProject.AllForms
If aO.Name = sForm Then
Set fm = Forms(aO.Name)
For Each ct In fm.Controls
If isBound(ct) Then
'Do stuff here
End If
Next ct
Set fm = Nothing
If Not bIsLoaded Then
On Error Resume Next
DoCmd.Close acForm, aO.Name, acSaveYes
End If
Exit For
End If
Next