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(cCollection As String, cAction As String, Optional
nMode = enumActionOpenRead)
'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_EnumDatabase
Set db = CurrentDb
Set ctr = db.Containers(cCollection)
For Each doc In ctr.Documents
' "optioneel" openen
Select Case nMode
Case enumActionNothing
Case enumActionOpenRead, enumActionOpenWrite
docmode = acDesign
Case enumActionView
docmode = acNormal
End Select
If nMode > enumActionNothing Then
Select Case cCollection
Case "forms"
DoCmd.OpenForm doc.Name, docmode
Case "reports"
DoCmd.OpenReport doc.Name, docmode
Case "tables"
DoCmd.OpenTable doc.Name, docmode
Case "modules"
DoCmd.OpenModule doc.Name, docmode
End Select
End If
'werkpaard:
Eval cAction & Quote & doc.Name & Quote & ")"
' "optioneel" sluiten
Select Case nMode
Case enumActionNothing
Case enumActionOpenRead, enumActionView
docmode = acSaveNo
Case enumActionOpenWrite
docmode = acSaveYes
End Select
If nMode > enumActionNothing 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_EnumDatabase:
Set ctr = Nothing
Set db = Nothing
Exit Sub
err_EnumDatabase:
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(cControl 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, enumActionOpenWrite
End Sub
Function execDFP(cControl As String, cProperty As String, cNewValue As
String, cForm As String) As Boolean
On Error Resume Next
Forms(cForm).Controls(cControl).Properties(cProper ty).Value = cNewValue
End Function
You can now call for instance
DoFormPatch "txtUser","background","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