design time control properties

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I have an old database I am working on which is rather
large. The first thing I want to do is to standardize the
look of all the forms.

So all text boxes have the same backcolor, bordercolor ,
special effect etc

and rectangles,labels and command buttons are set the
same etc.

I can do this code at run time - but is there a way of
running this code at design time ( thus only having to
run it once rather than everytime the application runs)
as these cahnges are to be permanent design changes.

Please tell me I do not have to do this manually.

Thanks for any assistance. Paul
 
Hi Paul,

Here is some code which I wrote a while back to fix the pesky problem of the
default true setting AllowDesignChanges property of forms. You can easily
modify this code to set your common form properties:

Public Sub DisableDesignChanges()
' Comments :
' Parameters: -
' Modified : 07/31/2000 SMD
'

On Error GoTo Proc_Err
Dim dbs As DAO.Database
Dim doc As Document
Dim lngI As Long
Set dbs = CurrentDb
lngI = 1
For Each doc In dbs.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Forms(doc.Name).AllowDesignChanges = False
lngI = lngI + 1
' The following lines just allow the doevents to occur on every
15th iteration,
' which seems sufficient to prevent the CPu from being completely
tied up
If (lngI Mod 15 = 0) Then
DoEvents
End If
DoCmd.Close acForm, Forms(doc.Name).Name, acSaveYes
Next

Proc_Exit:
Set doc = Nothing
Set dbs = Nothing
Exit Sub

Proc_Err:
MsgBox Err.Number & vbCrLf & Error$
Resume Next
End Sub
 
I got this from a previous post but it does work.

1. Set up a new form that has the exact specifications you
want in every form - you can't use the wizard to design it,
you must design it from scratch.

2. Save it and give it a name like "frm_Template"

3. Now click on Tools, then Options, then go to the Forms
tab. You should see a box where you can put in the
template name. Usually, it defaults to "Normal". Just
change it to "frm_Template" and now every new form you
create in that database will look just like your template.

This way, you create a form exactly the way you like it
(size, properties and all) and every time you create a new
one, it's going to be just how you like it.

Jim
 
Thanks Sandra got that to work.
-----Original Message-----
Hi Paul,

Here is some code which I wrote a while back to fix the pesky problem of the
default true setting AllowDesignChanges property of forms. You can easily
modify this code to set your common form properties:

Public Sub DisableDesignChanges()
' Comments :
' Parameters: -
' Modified : 07/31/2000 SMD
'

On Error GoTo Proc_Err
Dim dbs As DAO.Database
Dim doc As Document
Dim lngI As Long
Set dbs = CurrentDb
lngI = 1
For Each doc In dbs.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Forms(doc.Name).AllowDesignChanges = False
lngI = lngI + 1
' The following lines just allow the doevents to occur on every
15th iteration,
' which seems sufficient to prevent the CPu from being completely
tied up
If (lngI Mod 15 = 0) Then
DoEvents
End If
DoCmd.Close acForm, Forms(doc.Name).Name, acSaveYes
Next

Proc_Exit:
Set doc = Nothing
Set dbs = Nothing
Exit Sub

Proc_Err:
MsgBox Err.Number & vbCrLf & Error$
Resume Next
End Sub



--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

I have an old database I am working on which is rather
large. The first thing I want to do is to standardize the
look of all the forms.

So all text boxes have the same backcolor, bordercolor ,
special effect etc

and rectangles,labels and command buttons are set the
same etc.

I can do this code at run time - but is there a way of
running this code at design time ( thus only having to
run it once rather than everytime the application runs)
as these cahnges are to be permanent design changes.

Please tell me I do not have to do this manually.

Thanks for any assistance. Paul

.
 
Back
Top