G
Guest
I have tried using this code on my form to trap Required fields being left
empty. It does not work properly though, it is a continuous form - could this
cause a problem?
Three of my text boxes have a Tag of Reqd, values for them have to be
entered before a record can be saved. Even if I fill in all three fields
though I can not save the record, it prompts with the 'Value Required' text?
Thanks
Sue
Dim ctl As Control
For Each ctl In Me.Section(0).Controls
If ctl.Tag = "Reqd" Then
If Len(Trim(Nz(ctl, vbNullString))) Then
MsgBox ctl.name & " Requires A Value", vbExclamation + vbOKOnly
Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next
empty. It does not work properly though, it is a continuous form - could this
cause a problem?
Three of my text boxes have a Tag of Reqd, values for them have to be
entered before a record can be saved. Even if I fill in all three fields
though I can not save the record, it prompts with the 'Value Required' text?
Thanks
Sue
Dim ctl As Control
For Each ctl In Me.Section(0).Controls
If ctl.Tag = "Reqd" Then
If Len(Trim(Nz(ctl, vbNullString))) Then
MsgBox ctl.name & " Requires A Value", vbExclamation + vbOKOnly
Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next