hi
i have a piece of code that carrys out some form validation, see below
but i dont seem to be able to get it to work on a sub form, i have a button on the main form when i click it, it runs the function CheckforEmpty, but id doesnt check the sub form, how can i get it to check the sub form aswell.
thanks in advance
i have a piece of code that carrys out some form validation, see below
Code:
'form Validation
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(250, 240, 10)
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
but i dont seem to be able to get it to work on a sub form, i have a button on the main form when i click it, it runs the function CheckforEmpty, but id doesnt check the sub form, how can i get it to check the sub form aswell.
thanks in advance