Hi all,
I'm doing up a simple database for a church and I'm setting up some bells and whistles where they can change the colour of their forms and logo if they wish.
I have all of that set up nicely. Problem I'm having is every form I have to place the following code:
Is there a way where I can set this up as a global function and just call it from the forms? I can do The top half( ie the Dim's and the dlookup lines, but the rest is specific to the forms. It would be nice to be able to do the whole chunk of code as a global function.
Cheers
Dean
-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
I'm doing up a simple database for a church and I'm setting up some bells and whistles where they can change the colour of their forms and logo if they wish.
I have all of that set up nicely. Problem I'm having is every form I have to place the following code:
Code:
Dim head, bod, img, fore As String
Dim ctl As Control
head = DLookup("headercolour", "defaultsTBL")
bod = DLookup("bodycolor", "defaultsTBL")
img = DLookup("dblogo", "defaultsTBL")
fore = DLookup("Titles", "defaultsTBL")
Me.FormHeader.BackColor = head
Me.Detail.BackColor = bod
Me.LogoIMG.Picture = img
For Each ctl In Me.Controls
If ctl.Tag = "1" Then
ctl.ForeColor = fore
Else
End If
Next
Me.lblname.Caption = "Logged in as: " & Forms!LoginFRM!txtName
Is there a way where I can set this up as a global function and just call it from the forms? I can do The top half( ie the Dim's and the dlookup lines, but the rest is specific to the forms. It would be nice to be able to do the whole chunk of code as a global function.
Cheers
Dean
-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."