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
Ofer Cohen - 29 Mar 2007 13:08 GMT
You need the criteria for the Len = 0
If Len(Trim(Nz(ctl, vbNullString))) = 0 Then

Signature
Good Luck
BS"D
> 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
[quoted text clipped - 21 lines]
>
> Next
hughess7 - 29 Mar 2007 13:32 GMT
Excellent thanks that did the trick ;-). Sorry, copied code from another
example which had that bit missing.
Thanks again
Sue
> You need the criteria for the Len = 0
>
[quoted text clipped - 25 lines]
> >
> > Next