I have a really easy data-entry error trapping routine that doesn't 
even use dialog boxes.  Instead, it turns the bound control (listbox, 
textbox or whatever) and it's associated label red.  You would need 
to paste this in the Exit routine for each field you wanted to 
validate.  In addition, you would need to change the names of the 
controls to match those on your form.

==================================
Private Sub txtCustomerFirst_Exit(Cancel As Integer)

If IsNull(txtCustomerFirst) Then

Cancel = 1

Else: Cancel = 0

End If

If Cancel = 1 Then

txtCustomerFirst.BackColor = vbRed
lblCustomerFirst.ForeColor = vbRed
txtCustomerFirst.SetFocus

Else

txtCustomerFirst.BackColor = vbWhite
lblCustomerFirst.ForeColor = vbBlack
txtCustomerLast.SetFocus

End If

End Sub

=============================

It uses the "Cancel" argument of the "Exit" procedure to determine 
whether or not to move to the next field.  If it doesn't move to the 
next field, it turns the field bound control's BACKGROUND color and 
the associated label's FOREGROUND color (text color) to RED.  If it 
does move to the next field, it makes sure that the field has a 
background color of white, and the label has a text color of black.

Enjoy!

Alienwebmaster



--- In [email protected], Dennis Jensen 
<[EMAIL PROTECTED]> wrote:

> This depends on how much error trapping you want to do
> on data entry.





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessVBACentral/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to