By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,154 Members | 2,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,154 IT Pros & Developers. It's quick & easy.

Anyway to change the "style" of an existing form??

P: n/a
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

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.