M
Mat Child
Hi,
Currently i have some subs that perform common tasks on many forms within
the DB.
When calling the sub the form's object description is passed through
eg
the following colours in the form based on a value displayed on it.
Public Sub ColourMeIn(callingform As Object, Reason As String)
Dim Colour As Long
Select Case (Reason)
Case "LANDESK"
Colour = 6723891
Case "DEPLOYMENT"
Colour = 16035722
Case "STACK"
Colour = 39423
Case "VANILLA"
Colour = 14548479
End Select
With callingform
.FormHeader.BackColor = Colour
.Detail.BackColor = Colour
.FormFooter.BackColor = Colour
End With
End Sub
it's normally called as follows
ColourMeIn Forms![1-05 VIEW RELEASE].Form, Me!Rel_Type
Instead of explicitly coding the name of the form i'm trying to use a method
of calculating the value. I can create a string that replicates the name
formname = "forms![" & me.Name & "].form"
but passing this value to the sub causes the error "ByRef argument type
mismatch"
is there anyway to convert the string to an object?
Currently i have some subs that perform common tasks on many forms within
the DB.
When calling the sub the form's object description is passed through
eg
the following colours in the form based on a value displayed on it.
Public Sub ColourMeIn(callingform As Object, Reason As String)
Dim Colour As Long
Select Case (Reason)
Case "LANDESK"
Colour = 6723891
Case "DEPLOYMENT"
Colour = 16035722
Case "STACK"
Colour = 39423
Case "VANILLA"
Colour = 14548479
End Select
With callingform
.FormHeader.BackColor = Colour
.Detail.BackColor = Colour
.FormFooter.BackColor = Colour
End With
End Sub
it's normally called as follows
ColourMeIn Forms![1-05 VIEW RELEASE].Form, Me!Rel_Type
Instead of explicitly coding the name of the form i'm trying to use a method
of calculating the value. I can create a string that replicates the name
formname = "forms![" & me.Name & "].form"
but passing this value to the sub causes the error "ByRef argument type
mismatch"
is there anyway to convert the string to an object?