Setting form properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to set up, through code, the properties I'd like to assign to my forms, instead of having to do this to each form I create. I have attached what I have started to write. I put this in a separate module and referenced it in the On Load event. I keep getting an error. What have I done wrong

Sub FormSetUp(Frm As Form

Dim C As Contro
For Each C In Frm.Control
With
.DefaultView =
.ScrollBars =
End Wit
Nex
End Su

Thanks..

Don Rountree
 
Dear Don:

I am no expert, but perhaps the problem occurs because some of the controls
in frm.controls don't have the properties of "Scrollbars"...?

Anyway, Sandra Daigle once kindly gave me the following code, which I
believe will do what you want:


Public Function DisableDesignChanges()
' Comments : Code from Sandra Daigle to set the Allow Design Changes
property
' on all forms to "Design View Only". This prevents property sheets from
appearing
' in form view.
' 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 'Here you insert whatever lines
you need to change whatever properties
'you
want
lngI = lngI + 1
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 Function

Proc_Err:
MsgBox err.Number & vbCrLf & Error$
Resume Next
End Function

HTH
Fred Boer



Don Rountree said:
I would like to set up, through code, the properties I'd like to assign to
my forms, instead of having to do this to each form I create. I have
attached what I have started to write. I put this in a separate module and
referenced it in the On Load event. I keep getting an error. What have I
done wrong?
 
Back
Top