L
lambertsm via AccessMonster.com
I can’t figure out how to run this for the life of me.
Trying to run a function that updates the combo boxes for all open forms.
Here is what I have with asterisks marked on what I think is the problem line.
Have tried many permutations and gotten all sorts of new and exciting errors
but none that has worked right yet.
Sub AllForms()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
If obj.IsLoaded = True Then
*******What goes here to call the requeryCombos function?***********
End If
Next obj
End Sub
Public Function RequeryCombos(frm As Form)
' Requery all combo and list boxes on
'the argument form
' and on any subforms it may contain, and any of their
' subforms, and so on.
Dim ctl As Control
With frm
For Each ctl In .Controls
Select Case ctl.ControlType
Case acListBox, acComboBox
ctl.Requery
Case acSubform
If Len(ctl.SourceObject) > 0 Then
RequeryCombos ctl.Form
End If
End Select
Next ctl
End With
End Function
Any insights would be much appreciated!
Shauna
Trying to run a function that updates the combo boxes for all open forms.
Here is what I have with asterisks marked on what I think is the problem line.
Have tried many permutations and gotten all sorts of new and exciting errors
but none that has worked right yet.
Sub AllForms()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
If obj.IsLoaded = True Then
*******What goes here to call the requeryCombos function?***********
End If
Next obj
End Sub
Public Function RequeryCombos(frm As Form)
' Requery all combo and list boxes on
'the argument form
' and on any subforms it may contain, and any of their
' subforms, and so on.
Dim ctl As Control
With frm
For Each ctl In .Controls
Select Case ctl.ControlType
Case acListBox, acComboBox
ctl.Requery
Case acSubform
If Len(ctl.SourceObject) > 0 Then
RequeryCombos ctl.Form
End If
End Select
Next ctl
End With
End Function
Any insights would be much appreciated!
Shauna