J
Jim Evans
I want to change the backcolor of each section of each form in the database.
Acc 2003. Here is what I have finally writter. It does nothing but open each
form and then close it.
The line, strDo = "Forms!" & strForm & ".Detail.BackColor = 16119290" does
nothing but set the value of the variable. I kept getting an error that
"Object Needed" with the strDo = portion. But, this line represents the
action I want to take on each form section. I know that I will need a
For...Next loop to apply the change to all sections, which, what will happen
if a section does not exist on that particular form?
Private Function fFormSectionBack()
Dim obj As AccessObject, dbs As Object
Dim Detail As Section
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
lngCount = dbs.AllForms.Count
Debug.Print lngCount
For Each obj In dbs.AllForms
strForm = obj.Name
Debug.Print strForm
DoCmd.OpenForm strForm, acDesign
strDo = "Forms!" & strForm & ".Detail.BackColor = 16119290"
DoCmd.Close acForm, strForm, acSaveYes
'Debug.Print
Next
End Function
Jim
Acc 2003. Here is what I have finally writter. It does nothing but open each
form and then close it.
The line, strDo = "Forms!" & strForm & ".Detail.BackColor = 16119290" does
nothing but set the value of the variable. I kept getting an error that
"Object Needed" with the strDo = portion. But, this line represents the
action I want to take on each form section. I know that I will need a
For...Next loop to apply the change to all sections, which, what will happen
if a section does not exist on that particular form?
Private Function fFormSectionBack()
Dim obj As AccessObject, dbs As Object
Dim Detail As Section
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
lngCount = dbs.AllForms.Count
Debug.Print lngCount
For Each obj In dbs.AllForms
strForm = obj.Name
Debug.Print strForm
DoCmd.OpenForm strForm, acDesign
strDo = "Forms!" & strForm & ".Detail.BackColor = 16119290"
DoCmd.Close acForm, strForm, acSaveYes
'Debug.Print
Next
End Function
Jim