Hey folks!
In a form, a few fields should have their format (font color, type and weight) changed based on their value.
I created a function to be called once for each of the necessary fields, from within the OnCurrent trap event.
My problem is: how to pass the field name to the function (it will not necessarily be the current field, and not all fields on the form)
Below is a "short" version of the problem
Private Sub Form_Current()
On Error GoTo Err_Form_Current
fncRemarksButtons (Me.myField01)
fncRemarksButtons (Me.myField02)
fncRemarksButtons (Me.myField03)
...
fncRemarksButtons (Me.myFieldNN)
Exit_Form_Current:
Exit Sub
Err_Form_Current:
MsgBox Err.Description
Resume Exit_Form_Current
End Sub
_______________________________
Function fncRemarksButtons(varRemarksButton As Variant)
With varRemarksButton
If .Value = -1 Then
.Caption = "YES"
.FontWeight = conHeavy
.ForeColor = conDarkBlue
Else
.Caption = "NO"
.FontWeight = conNormal
.ForeColor = conBlack
End If
End With
End Function
Any help is truly appreciated.
L.R. Humberto
If you don't know where you are going to, doesn't matter how fast you are going, you'll never get there.
In a form, a few fields should have their format (font color, type and weight) changed based on their value.
I created a function to be called once for each of the necessary fields, from within the OnCurrent trap event.
My problem is: how to pass the field name to the function (it will not necessarily be the current field, and not all fields on the form)
Below is a "short" version of the problem
Private Sub Form_Current()
On Error GoTo Err_Form_Current
fncRemarksButtons (Me.myField01)
fncRemarksButtons (Me.myField02)
fncRemarksButtons (Me.myField03)
...
fncRemarksButtons (Me.myFieldNN)
Exit_Form_Current:
Exit Sub
Err_Form_Current:
MsgBox Err.Description
Resume Exit_Form_Current
End Sub
_______________________________
Function fncRemarksButtons(varRemarksButton As Variant)
With varRemarksButton
If .Value = -1 Then
.Caption = "YES"
.FontWeight = conHeavy
.ForeColor = conDarkBlue
Else
.Caption = "NO"
.FontWeight = conNormal
.ForeColor = conBlack
End If
End With
End Function
Any help is truly appreciated.
L.R. Humberto
If you don't know where you are going to, doesn't matter how fast you are going, you'll never get there.