Results 1 to 7 of 7
  1. #1
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150

    MS Access 2166 - Cannot Lock Control While It has Unsaved Changes

    Hi,

    I searched. Can't seem to find a solution.

    I am attempting to lock an Option Group (frame) when a textbox property contains any text.

    I tried changing the focus back and fourth between the textbox and the option group...

    Please see attached with code.



    Thanks for your help.TBChange.accdb

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    See if this works for you. Changed the textbox event from on_change to after_update. On_Change fires for every keystroke, not what you want.
    Added code to guarantee that the Enter key will leave the textbox, and not just create multiple lines.

  3. #3
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150
    Quote Originally Posted by davegri View Post
    See if this works for you. Changed the textbox event from on_change to after_update. On_Change fires for every keystroke, not what you want.
    Added code to guarantee that the Enter key will leave the textbox, and not just create multiple lines.
    Davegri,

    Thanks, however, I do want the event to fire after every keystroke. Enter is another step I don't want the user to have to take. Its compromising design, which is why I did not use afterupdate event. But your solution is better than none.

    Nonetheless, I have changed the design a bit so I am no longer required to lock the option group. But it appears with is not possible with this event. No solution online exists for locking a control with textbox change events. At least when doing with frames.

    Regards,

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I thought this resolved in https://www.accessforums.net/showthread.php?t=74619

    What has changed?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150
    Hi June7,

    I shouldve posted code.

    Instead of setting enable property in the event, I am now setting locked property instead. This throws the error and to all my research is not possible for whatever reason.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Attachment 36318

    Try this one.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why is Locked preferred over Enabled? Locking just adds confusion to user because control still looks available. Tab Stop even still works to allow focus on the control. Enabled set to False eliminates both.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-21-2017, 03:52 PM
  2. Replies: 5
    Last Post: 11-13-2017, 02:09 PM
  3. Replies: 10
    Last Post: 08-31-2016, 01:19 PM
  4. Lock control after data entry
    By Scott_80 in forum Programming
    Replies: 12
    Last Post: 01-07-2015, 03:35 PM
  5. Access DB Lock Out
    By ETCallHome in forum Programming
    Replies: 3
    Last Post: 06-13-2011, 08:22 AM

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