Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2003
    Posts
    4

    Red face Unanswered: Lost Focus and Exit Events not running?

    I have an access 2000 db with 1 form and several text boxes. All text boxes are bound to different fields in 1 table. The problem I am having is when moving to the next text box, the lost focus and exit events are not running. Here is an example:

    Private Sub Text1_LostFocus()
    Msgbox "Lost Focus"
    Exit Sub

    Private Sub Text1_Exit (Cancel as Integer)
    Msgbox "Exit"
    Exit Sub

    When the user enters text into Text1, and then moves to the Text2, no message boxes are seen.
    One other thing, sometimes on some of the text boxes, the lost focus will work, sometimes the exit will work, and sometimes neither.

    I was hoping for a different solution other than setting up unbound text boxes for data entry, copying the text to hidden bound text boxes and updating the table.

    Thanks for your help
    Chris

  2. #2
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120

    Maybe

    Is it just a typo:

    Exit Sub (Should be End Sub?)

    Michael

  3. #3
    Join Date
    Jun 2003
    Posts
    4
    Sorry, it was a typo. It should end in End Sub.

    Thanks
    Chris

  4. #4
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120

    No problem!!

    Be Happy !! Not sorry !

    Glad that's all it was :}}

    Michael

  5. #5
    Join Date
    Jun 2003
    Posts
    4
    In access, it does have end sub, however when posting to this forum, I mistakenly typed exit sub. The program still does not work

    Chris

  6. #6
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120
    Well, ya got me.

    I tried it at home, and it works every time.

    Hopefully someone will recognize the situation and reply.

    Michael

  7. #7
    Join Date
    Jun 2003
    Location
    Central PA, in the mountains
    Posts
    4

    Wink Possible fix???

    I had this happen to an existing app/DB that was WinZipped and backed up to a floppy. Had some help from a bud at work who couldn't figure it out either, and now I can't figure out how he did this, but he turned off something that allowed ADO or DOA use (can't find it now) and then turned it right back on and it seemed to be ok then. If you really want to know, I can check with him tomorrow at work.
    thanks,
    me

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Something to check...

    Your subroutines are labeled Text1_LostFocus and Text1_Exit.

    If you subsequently renamed your control boxes to something more descriptive the subroutines are not automatically renamed and will not be called. You will have to rename the subroutines and make sure the control boxes reference them correctly.

    blindman

  9. #9
    Join Date
    Jun 2003
    Posts
    4
    For anyone else that has this problem, here was my solution. Thanks to GringoMike on experts-exchange. The problem and solution was exactly what happened. Thanks for everyones help.

    chris


    Check to make sure that all text boxes' "Event" properties actually point to a procedure in the form's code. Sometimes when I design a quick form and use the VB editor drop-down box to select the objects & events, the don't actually get "linked" to the object on the form because I didn't go thru the form's design view, properties, object's event tab in properties, and create the procedure from there.

    Bottom line, for every text box that doesn't work, look in the "Event" properties to make sure that it says "[Event Procedure]" and points to a procedure in the form's code. I can clarify if needed.

    Cheers,
    Mike

  10. #10
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120
    Good call blindman.

    Michael

Posting Permissions

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