I have applied validation rule on before update event but I am getting compile error kindly check and suggest please. I have added the code and screenshot.
It is showing compile error on "=" sign on CheckForEmpty in before update event.
Kindly suggest
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Forms!frmTransactionsMain!lblReceipt.Visible = True Then
If CheckForEmpty = False Then
MsgBox "Please fill in the coloured fields"
Else
MsgBox "Do Action"
End If
End If
End Sub
Function CheckForEmpty() As Boolean
CheckForEmpty = True
ClearControlFormatting
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.Tag = "Fill" Then
If IsNull(Ctrl) Or Len(Ctrl) = 0 Then
Ctrl.BackColor = RGB(153, 204, 255)
CheckForEmpty = False
End If
End If
Next
End Function
Sub ClearControlFormatting()
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.Tag = "Fill" Then
Ctrl.backcolor = vbWhite
End If
Next
End Sub
Private Sub Form_Current()
ClearControlFormatting
End Sub
It is showing compile error on "=" sign on CheckForEmpty in before update event.
Kindly suggest
Attachments
Last edited: