Results 1 to 2 of 2
  1. #1
    TenOc is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    94

    Need to lose focus on a button on a sub form.

    I have a main form with a sub form. On the main form I have a unbound combo box that is used to select a specific record for the subform. On the subform I have a "cancel" button that "undoRecord" any changes made without saving. This undo button is hidden unless there has been some edits made to the record.



    When the user select a new record by way of the combo box I want to make the cancel button visibility false. The problem is this button still has the focus and I can not change its visibility to false.

    Is here a good way to lose (or move) the focus from the button other than setting the focus to some other control on the subform?

    I had assumed that then the user starts to select an new record the focus would move to the combo box, but since I am getting an error that the cancel button still has the focus and I can not change it visibility, I was mistaken.

    I have tried the events for the combo box for click and change without any luck.

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    I have tried the events for the combo box for click and change without any luck.
    Usually the After Update event is the best to use.

    Not quite sure why the button would get the focus when you do something on the main form but it should be as simple as setting the focus to another control before changing the visible property.

    Code:
    Me.SomeControl.SetFocus
    Me.MyButton.Visible = false
    What exactly is the error message? What code have you tried and whats the code for the combobox?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-18-2016, 06:00 AM
  2. Alt-Tab makes popup form lose focus
    By keviny04 in forum Forms
    Replies: 4
    Last Post: 04-21-2015, 10:38 AM
  3. Replies: 11
    Last Post: 01-26-2012, 01:22 PM
  4. Verifing Data in a text box when it lose focus...
    By hswilliams2525 in forum Access
    Replies: 1
    Last Post: 01-17-2012, 08:36 PM
  5. Update Database on Lose Focus event
    By sgroth in forum Forms
    Replies: 2
    Last Post: 06-11-2011, 07:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums