G
Guest
Hi,
I need to check to make sure all 40 text fields on a form are inputted. I
have 40 fields on a form that I have marked in the TAG section on each field
property to be 'reqd'. I then run a routine on form before update to check
if all the fields are inputted by checking for string length.
I now have to add an exception line......meaning .....if DESC field contents
are called "LAPTOP" and the FIRST_NAME field is empty then I need to bypass
the error message and exit the subroutine.
It is not working ...any ideas?
Private Sub Form_BeforeUpdate(Cancel As Integer) Dim ctl As Control For Each
ctl In Me.Controls
If ctl.Tag = "reqd" Then
If Len(ctl.Value & vbNullString) = 0 Then
If Me!DESC_ = "LAPTOP" And Me!FIRST_NAME = "" Then Exit Sub
MsgBox "You must enter a value into """ & _
ctl.Controls(0).Caption & """."
ctl.SetFocus
Exit Sub
End If
End If
Next
End Sub
Thanks
I need to check to make sure all 40 text fields on a form are inputted. I
have 40 fields on a form that I have marked in the TAG section on each field
property to be 'reqd'. I then run a routine on form before update to check
if all the fields are inputted by checking for string length.
I now have to add an exception line......meaning .....if DESC field contents
are called "LAPTOP" and the FIRST_NAME field is empty then I need to bypass
the error message and exit the subroutine.
It is not working ...any ideas?
Private Sub Form_BeforeUpdate(Cancel As Integer) Dim ctl As Control For Each
ctl In Me.Controls
If ctl.Tag = "reqd" Then
If Len(ctl.Value & vbNullString) = 0 Then
If Me!DESC_ = "LAPTOP" And Me!FIRST_NAME = "" Then Exit Sub
MsgBox "You must enter a value into """ & _
ctl.Controls(0).Caption & """."
ctl.SetFocus
Exit Sub
End If
End If
Next
End Sub
Thanks