Change form properties globally

G

google3luo359

Just curious as to this one (I'm currently changing over a dozen form
property boxes).

For property things like control box, border, caption etc.
Is it possible to globally change various properties in all of your
forms, at once?

TIA Ric
 
A

Allen Browne

It is possible to code to to this.

Assuming Access 2000 or later, use CurrentProject.AllForms to find the form
names. Open them in design view, hidden if you wish. Make the changes. Save.
Close. Loop through the rest of the forms.

This kind of thing:

Function FixAllForms()
Dim accObj As AccessObject
Dim strForm As String
Dim frm As Form

For Each accObj In CurrentProject.AllForms
strForm = accObj.Name
DoCmd.OpenForm strForm, acDesign, WindowMode:=acHidden

Set frm = Forms(strForm)
frm.ControlBox = False
'etc for other properties

Set frm = Nothing
DoCmd.Close acForm, strForm, acSaveYes
Next
End Function
 
G

google3luo359

Ahhh... that's perfect Allen. Thanks very much. That will be very
helpful as I proceed.

Ric
 
G

google3luo359

Hi Allen,

Quick question on this technique.
Will it loop through all forms in the project or just the current one
open?
Most times I'd just need to change the properties on the objects in the
current form/subform.

Ric
 
A

Allen Browne

The loop goes through all forms in your database.

If you just want to change one form, it would be easier to do it by hand.
 
Top