I have a report that does some conditional formating of field information. Basically if something doesn't appear correct, I want it to be "highlighted" on the form. So for a bunch of fields, I do this type of check....
If (MyField > 100) Then
Me!MyField.ForeColor = vbRed
Me!MyField.FontBold = True
Me!MyField.BorderStyle = 1
Else
Me!MyField.ForeColor = vbBlack
Me!MyField.FontBold = False
Me!MyField.BorderStyle = 0
End If
End If
This works fine, but I have many fields that I want to do the same thing with.
I want to write a procedure setHighlight, where I can pass the field control, and a TRUE/FALSE parameter. Within the setHighlight procedure the display properties of the control would be set based upon the TRUE/FALSE parameter.
I am not sure what to define the parameter as for the procedure declaration...
Public Sub setHighlight(ByRef field As ????????, ByVal highlight As Boolean)
And then I am not sure on the syntax to send the field to the procedure...
Call setHighlight(Me!MyField, TRUE) ???
I tried defining the parameter to the setHighlight procedure as an AccessObject. When I try to call the procedure however it looks like it tries to send the current value of the field to the procedure rather than sending the field object itself.
Any suggestions ???
If (MyField > 100) Then
Me!MyField.ForeColor = vbRed
Me!MyField.FontBold = True
Me!MyField.BorderStyle = 1
Else
Me!MyField.ForeColor = vbBlack
Me!MyField.FontBold = False
Me!MyField.BorderStyle = 0
End If
End If
This works fine, but I have many fields that I want to do the same thing with.
I want to write a procedure setHighlight, where I can pass the field control, and a TRUE/FALSE parameter. Within the setHighlight procedure the display properties of the control would be set based upon the TRUE/FALSE parameter.
I am not sure what to define the parameter as for the procedure declaration...
Public Sub setHighlight(ByRef field As ????????, ByVal highlight As Boolean)
And then I am not sure on the syntax to send the field to the procedure...
Call setHighlight(Me!MyField, TRUE) ???
I tried defining the parameter to the setHighlight procedure as an AccessObject. When I try to call the procedure however it looks like it tries to send the current value of the field to the procedure rather than sending the field object itself.
Any suggestions ???