17/07/2009, 20:32
Aşağıdaki kod ile VT'deki tüm formların araç çubukları değiştirebilirsiniz. En iyisi her VT için yönetim paneli oluşturulması.
Burdaki kod plain'le başlayan formları es geçer, uyarlamayı unutmayınız.
PHP Kod:
Public Sub SetFormToolbars()
Dim objFrm As AccessObject, frm As Form, ctl As Control
' Go through every form in the database
For Each objFrm In CurrentProject.AllForms
' Skip fixing any "plain" examples
If Right(objFrm.Name, 5) <> "plain" Then
DoCmd.OpenForm FormName:=objFrm.Name, View:=acDesign, WindowMode:=acHidden
' Set a pointer to the form just opened
Set frm = Forms(objFrm.Name)
' Set custom menu and toolbars for the form object
' .. only for primary forms
If Left(frm.Name, 3) = "frm" Then
' Clear any saved filter while we're at it
Forms(frm.Name).Filter = ""
' Set the custom menu bar
Forms(frm.Name).MenuBar = "FormMenuBar"
' Set the custom toolbar
Forms(frm.Name).Toolbar = "FormToolbox"
' Set the custom shortcut menu bar
Forms(frm.Name).ShortcutMenuBar = ""
End If
' Loop through all controls
For Each ctl In frm.Controls
' Skip control types that don't have a ShortcutMenuBar property
If (ctl.ControlType <> acCustomControl) And _
(ctl.ControlType <> acSubform) And _
(ctl.ControlType <> acRectangle) And _
(ctl.ControlType <> acLabel) And _
(ctl.ControlType <> acLine) And _
(ctl.ControlType <> acPageBreak) Then
' Set the custom control shortcut menu
ctl.ShortcutMenuBar = ""
End If
' Loop through all controls on the form
Next ctl
' Fix AllowDesignChanges while we're at it
frm.AllowDesignChanges = False
' Close and save the result
DoCmd.Close acForm, objFrm.Name, acSaveYes
End If
' Loop to get the next form
Next objFrm
' Clean up
Set ctl = Nothing
Set frm = Nothing
Set objFrm = Nothing
End Sub
Burdaki kod plain'le başlayan formları es geçer, uyarlamayı unutmayınız.