Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004

    Unanswered: Simple Validation Causing Run-Time Error 424

    I am using this code on a form to make sure that data is entered in the textbox named txtDepartmentName

    I am placing it in the BeforeUpdate Event

    If Me.txtDepartmentName Is Null Then
    MsgBox "Enter a Department", vbOKOnly, "Invalid Entry"
    Cancel = True
    End If

    When I try to save a record with no data in the textbox, I get an error

    run-time error: '424'
    object required

    Why is this happenning?

    Thanks - AB

  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    You will want to change:

    If Me.txtDepartmentName Is Null Then


    If IsNull(Me.txtDepartmentName) Then


    If Me.txtDepartmentName & "" = "" Then

    The second example works when Me.txtDepartmentName is either Null or an empty string. I would suggest using it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts