Hello,
I have a small problem I can't find the answer to, been looking and trying different things for almost two days now.
I have a form with about 90 text-boxes (logging form for a test) and I am trying to make it so that when all fields are filled out then a label turn green and turn red if any of the fields is empty.
Here is the code I have so far
The problem is that as soon as the form see a value in any of the fields then the label turn green.
Any help is appreciated.
I have a small problem I can't find the answer to, been looking and trying different things for almost two days now.
I have a form with about 90 text-boxes (logging form for a test) and I am trying to make it so that when all fields are filled out then a label turn green and turn red if any of the fields is empty.
Here is the code I have so far
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If Len(Nz(ctl.Value, vbNullString)) = 0 Then
Me.Parent!btn_FlowCurveLog.BackColor = vbRed
Else
Me.Parent!btn_FlowCurveLog.BackColor = vbGreen
End If
End Select
Next ctl
Exit Sub
End Sub
The problem is that as soon as the form see a value in any of the fields then the label turn green.
Any help is appreciated.
Last edited: