JMongi
Active member
- Local time
- Yesterday, 22:26
- Joined
- Jan 6, 2021
- Messages
- 802
I have two issues with my data validation function.
1. It either doesn't get called (form close w/ nothing)
2. I get an object doesn't support this property or method
Function:
BeforeUpdate Sub:
1. It either doesn't get called (form close w/ nothing)
2. I get an object doesn't support this property or method
Function:
Code:
Function FormNullChk(FormName As String) As Boolean
Dim Ctrl As Control
'Return a True if No Nulls or False if Nulls
For Each Ctrl In Forms(FormName).Controls
If Nz(Ctrl.Value) = 0 Then
FormNullChk = False
Exit For
Exit Function
End If
Next Ctrl
FormNullChk = True
End Function
BeforeUpdate Sub:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If FormNullChk(Me.Name) = False Then
Cancel = True
Else
Exit Sub
End If
End Sub