Richard Holliingsworth wrote:
Hello:
The group has new 'standards' for online forms and I need to change the
'style' of my existing forms (A2002). Can I do this? I can't find a
way using the GUI or the properties.
Thanks,
Richard H
Nope. I wrote small routines to change this or that property in all
forms I have.
Paste this in some module:
Sub EnumDatabase(cC ollection As String, cAction As String, Optional
nMode = enumActionOpenR ead)
'cCollection bevat Forms, of Tables, enz
'cAction is een functienaam MET HAAKJE OPENEN, en eventueel constante
argumenten (voorbeeld: execDFP)
' Elk document uit de collectie wordt naar deze functie gestuurd als
laatste argument
Dim db As Database
Dim ctr As Container
Dim doc As Document
Dim docmode As Long
On Error GoTo err_EnumDatabas e
Set db = CurrentDb
Set ctr = db.Containers(c Collection)
For Each doc In ctr.Documents
' "optioneel" openen
Select Case nMode
Case enumActionNothi ng
Case enumActionOpenR ead, enumActionOpenW rite
docmode = acDesign
Case enumActionView
docmode = acNormal
End Select
If nMode > enumActionNothi ng Then
Select Case cCollection
Case "forms"
DoCmd.OpenForm doc.Name, docmode
Case "reports"
DoCmd.OpenRepor t doc.Name, docmode
Case "tables"
DoCmd.OpenTable doc.Name, docmode
Case "modules"
DoCmd.OpenModul e doc.Name, docmode
End Select
End If
'werkpaard:
Eval cAction & Quote & doc.Name & Quote & ")"
' "optioneel" sluiten
Select Case nMode
Case enumActionNothi ng
Case enumActionOpenR ead, enumActionView
docmode = acSaveNo
Case enumActionOpenW rite
docmode = acSaveYes
End Select
If nMode > enumActionNothi ng Then
Select Case cCollection
Case "forms"
DoCmd.Close acForm, doc.Name, docmode
Case "reports"
DoCmd.Close acReport, doc.Name, docmode
Case "tables"
DoCmd.Close acTable, doc.Name, docmode
Case "modules"
DoCmd.Close acModule, doc.Name, docmode
End Select
End If
Next
exit_EnumDataba se:
Set ctr = Nothing
Set db = Nothing
Exit Sub
err_EnumDatabas e:
Select Case Err
Case Else
Debug.Print cAction & doc.Name & ")"
Debug.Print Err.number; Err.Description
Resume Next
End Select
End Sub
'een aantal implementaties met EnumDatabase
Sub DoFormPatch(cCo ntrol As String, cProperty As String, cNewValue As
String)
Dim action As String
action = "execDFP("
action = action & Quote & cControl & Quote & ","
action = action & Quote & cProperty & Quote & ","
action = action & Quote & cNewValue & Quote & ","
EnumDatabase "forms", action, enumActionOpenW rite
End Sub
Function execDFP(cContro l As String, cProperty As String, cNewValue As
String, cForm As String) As Boolean
On Error Resume Next
Forms(cForm).Co ntrols(cControl ).Properties(cP roperty).Value = cNewValue
End Function
You can now call for instance
DoFormPatch "txtUser","back ground","32768"
from the debug window.
And, you can use EnumDatabase for many more purposes. See if you can
follow it, mail me if you need english comments (I have no time for that
now).
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl