I am using the following function to turn a field red if a certain criteria is met:
Public Sub MakeRed(YesNo As Integer, Fieldname As Control)
If YesNo = 0 Then
With Fieldname
.SetFocus
.BackColor = 255
End With
End If
End Sub
It works fine if I call it as
Call Functions.MakeRed(0, Forms!People.Email)
but I am returning values from a database, and using this function to update multiple fields, as the code snippet below shows.
tick(1) = "Forms!VersionInfo.BBA99"
tick(2) = "Forms!VersionInfo.BBADetail"
tick(3) = "Forms!VersionInfo.BBS1"
tick(4) = "Forms!VersionInfo.BBS2"
tick(5) = "Forms!VersionInfo.BRE"
tick(6) = "Forms!VersionInfo.CullenB"
For X = 1 to 6
-----block of code to get resultset rst-----
Call Functions.MakeRed(rst.Fields(0), tick(X))
Next X
Calling it as such gives me an error of
Compile error:
ByRef argument type mismatch
which tells me that it's trying to pass a string to a control variable. I tried using Eval() but that function can only return string or numeric values. Not sure what to do next with it.
Public Sub MakeRed(YesNo As Integer, Fieldname As Control)
If YesNo = 0 Then
With Fieldname
.SetFocus
.BackColor = 255
End With
End If
End Sub
It works fine if I call it as
Call Functions.MakeRed(0, Forms!People.Email)
but I am returning values from a database, and using this function to update multiple fields, as the code snippet below shows.
tick(1) = "Forms!VersionInfo.BBA99"
tick(2) = "Forms!VersionInfo.BBADetail"
tick(3) = "Forms!VersionInfo.BBS1"
tick(4) = "Forms!VersionInfo.BBS2"
tick(5) = "Forms!VersionInfo.BRE"
tick(6) = "Forms!VersionInfo.CullenB"
For X = 1 to 6
-----block of code to get resultset rst-----
Call Functions.MakeRed(rst.Fields(0), tick(X))
Next X
Calling it as such gives me an error of
Compile error:
ByRef argument type mismatch
which tells me that it's trying to pass a string to a control variable. I tried using Eval() but that function can only return string or numeric values. Not sure what to do next with it.