Results 1 to 4 of 4
  1. #1
    jhg6308 is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2021
    Posts
    21

    Enabled=No and Locked=Yes, but cursor can still enter the control

    I have a continuous form where I've set all the controls to Enabled=No and Locked=Yes, expecting that those controls won't be clickable at all.

    But when I click on one, I get a blinking cursor and the field behaves as if it's going to accept input. It doesn't actually accept keystrokes but the field value moves and gets truncated on the right.

    I looked up the "Enabled" property but the current MS docs talk about enabling/disabling conditional formatting, which appears to be a doc error.

    What is the correct way to make a field un-clickable?

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    Only by disabling. If enabled but locked it can be selected but not edited. Regarding CF and the enabled property, I think the way to interpret what's written there is to consider that a disabled control (at least a textbox) can have no useful format. Add a control, set it's bg color to yellow and you get yellow. Disable it and you get no format at all - unless you consider grey a format. You can disable, have a border and make it transparent to get a more normal look, as long as you're ok with the control seeming to have the same colour as the form background.
    Last edited by Micron; 08-04-2021 at 07:22 PM. Reason: added comment
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I tested a textbox with Enabled = No and Locked = Yes. Cannot click or tab into it.

    It is not a Doc error. Enable/Disable can be controlled with Conditional Formatting.
    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.

  4. #4
    jhg6308 is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2021
    Posts
    21
    Quote Originally Posted by June7 View Post
    Enable/Disable can be controlled with Conditional Formatting.
    I finally figured out what you meant by this... I was using the CF to set the background color of the field depending on an expression. The UI is a bit confusing:


    1. There's a tiny button labeled "Enabled" in the CF Edit Format dialog. If you click the button, it causes the sample to the left to lose its background color, and the sample text goes gray. One would intuit from this that "Enabled" refers to the state of the conditional format, not the input-enablement of the field.
    2. However, even though the sample now has a gray background, what actually happened is that the input-enablement of the field (the "Enabled" status) was set to No for that condition.
    3. And, even though the sample is gray, the conditional background color is still applied.


    I believe what is wrong here is that the CF sample displayed in the Edit Format dialog does not take into account the state of the Locked attribute. When Enabled=NO and Locked=NO, a field is grayed out. BUT, when Enabled=NO and Locked=Yes, the field becomes untouchable and not grayed out. So when the CF Edit Format dialog is displaying a sample, it should be taking into account the current state of the Locked attribute so that the sample displayed corresponds to what will actually be seen.

    This solves my problem, and gives me a bit more insight into the "interesting" mind-set behind Access' design.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-23-2017, 11:25 AM
  2. Enabled and Locked properties
    By CQCDave in forum Access
    Replies: 1
    Last Post: 11-18-2015, 10:09 AM
  3. Replies: 7
    Last Post: 12-09-2014, 03:06 PM
  4. Replies: 3
    Last Post: 12-04-2014, 05:14 AM
  5. Replies: 2
    Last Post: 02-17-2012, 04:09 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