Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unanswered: How can I suppress error message #3314

    How can I disable error message #3314
    "The field numshipments cannot contain a Null value because the required property for this field is set to True. Enter a value in this
    field."

    I have custom error message for #3314 but this message still pops up.
    It'll display "The number of Shipments field is missing." Then Access
    display the error message above. I placed .SetWarnings property before If statement but it does work. How can I suppress the error
    message.

    Private Sub cmdClose_Click()


    On Error GoTo Err_cmdClose_Click
    DoCmd.SetWarnings False

    If IsNull(txtnumShipments) Then
    MsgBox "The Number of Shipments field is missing."
    Me!txtnumShipments.SetFocus

    Exit Sub

    Else
    DoCmd.Close
    End If



    Exit_cmdClose_Click:
    Exit Sub

    Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click

    End Sub

  2. #2
    Join Date
    Jul 2002
    Posts
    55
    Try changing your error handler to
    Code:
    Err_cmdClose_Click:
    If Err = 3314 Then ' or whatever your error number is
       Err.Clear
       ' Put your custom error message here
    Else
       MsgBox Err.Description
    End If
    Resume Exit_cmdClose_Click

  3. #3
    Join Date
    May 2002
    Posts
    395

    Angry

    Originally posted by Mulligan
    Try changing your error handler to
    Code:
    Err_cmdClose_Click:
    If Err = 3314 Then ' or whatever your error number is
       Err.Clear
       ' Put your custom error message here
    Else
       MsgBox Err.Description
    End If
    Resume Exit_cmdClose_Click
    Still doesn't work.
    I tried placing Err.Clear before and after my error message. The second
    message is still popping up.

  4. #4
    Join Date
    Jul 2002
    Posts
    55
    Ahhhh! You've got this in the Click event of a button, haven't you? My bad. Sorry.

    This isn't going to work then. The error is thrown as soon as the focus moves off the control txtNumShipments. You need to put the error handling in the AfterUpdate event of txtNumShipments. Either that, or set the Required property to False for the field, and just check if txtNumShipments is null in your Click event as you have been (and Exit Sub if it is).

    Mull

  5. #5
    Join Date
    Feb 2002
    Posts
    108

    Try This Then

    DoCmd.SetWarnings False

Posting Permissions

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