Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    110

    Unanswered: Text Box update error

    Hello everybody

    I have a text box which is supposed to take on date values. I would like to be able to check that an appropriate date value has been input in the text box, before the data is commited to the database. Thus, I tried using the beforeupdate() function of the text box, as shown below :

    Private Sub Hmeromhnia_BeforeUpdate(Cancel As Integer)
    If Not IsDate(Me.Hmeromhnia) Then
    MsgBox "Μη αποδεκτή ημερομηνία", vbCritical
    Cancel = True
    End If
    End Sub

    I thought that would solve the problem. Yet, when I enter something other than a date, I get another Access internal error message instead of the one in my code. In fact, I think that the subroutine is not called at all. In case a correct date value in input then the subroutine is called correctly and exits gracefully!
    Note, that the text box is part of a form and i`m using the beforeupdate() event of the form as well!

    Any suggestions?

    George Papadopoulos

  2. #2
    Join Date
    Mar 2004
    Location
    Netherlands
    Posts
    100
    I was using OnLostFocus. It will work when the user leaves the text box to write or click in another part of the form.

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can also use the Validation Rule or Input Format of your text box

  4. #4
    Join Date
    Apr 2004
    Posts
    110
    The problem is that the text box is bounded to a date field on a table of my database. Thus, some sort of internal validation check seems to take precedence over my code.

    Is there any way to change that?


    George Papadopoulos

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    When the text box is bounden to a date field, and you try to enter non Date value, you will get an error message from Access and not your already made error message

Posting Permissions

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