Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004

    Unanswered: Text box update problem

    Hello everybody

    This a rather old persistent problem I`m facing. I have a form with a text
    box bounded to a date field of a table. I have created a BeforeUpdate()
    event handler for the text box.
    The handler is supposed to check whether a valid date has been entered
    before allowing the update of the text box.
    When I enter an invalid date though, the handler does not seem to get
    called. Instead I get an error message from Access. When a valid date is entered the event handler executes, but finds nothing wrong.

    Can somebody shed some light?

    The event handler code is shown below :

    Private Sub Hmeromhnia_BeforeUpdate(Cancel As Integer)
    If Not IsDate(Me.Hmeromhnia) Then
    MsgBox "Ic a?iaaeo? cianiici?a", vbCritical
    Cancel = True
    End If
    End Sub

    George Papadopoulos

  2. #2
    Join Date
    Oct 2003
    Provided Answers: 1


    This is because this is a bounded TextBox to a Date Field, and ACCE$$ has internal check for Date Formats, which takes place before the Before Update event takes place.
    If you use an unbounded TextBox, your Before Update event would fire even if you enter an invalid date value

  3. #3
    Join Date
    Apr 2004
    Is there no way to overcome this when using a bounded text box? This causes a lot of problems when an invalid date is input. Access continues to display error messages even if the user decides to close the form.
    The only way the form can be exited is for the user to input a valid date.

    George Papadopoulos

Posting Permissions

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