Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    New Lounger
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disabling fields on forms (Access 2003)

    I have a form where I am calculating two fields and the rest are user entry fields. I want to keep the calculated fields as view only fields that the user can not access. I have the calculated fields set as Enabled = No and Locked = Yes. The first field that is a pure calculation

  2. #2
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disabling fields on forms (Access 2003)

    Have you set the Tab Stop property to No?
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disabling fields on forms (Access 2003)

    And are you sure that you have set the Enabled and Locked properties for the second text box? From your description I would guess that you have only set them correctly for the first text box.

  4. #4
    Star Lounger
    Join Date
    Nov 2005
    Location
    Edmonton, Alberta, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disabling fields on forms (Access 2003)

    I agree with HansV - sounds to me like you have the Locked property set to Yes, but somehow you neglected to set the Enabled property to No. I don't believe SteveH's suggestion of turning off the Tab stop property will make any difference - my databases have lots of locked fields, some permanently locked and some locked and unlocked in code, and I don't think I have ever played with the Tab stop property - if a field isn't enabled there's no way you can tab to it.

  5. #5
    New Lounger
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disabling fields on forms (Access 2003)

    I had missed the tab stop setting and setting it as suggested corrects the issue with landing on the field when tabbing or hitting enter. I can still click on the field and access the field enough that it displays the underlying numeric value instead of the Yes, No value. Interestingly if I leave the settings as Enabled = No, Locked = Yes and Tab Stop = Yes like the first field that is working correctly and just change the source to the same calculated value as the first field, then the second field also works just like the first field. If I put the Iif code back in it goes back to being accessible. The Iif statement seems to be a contributing factor

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disabling fields on forms (Access 2003)

    What you describe is very strange - the settings Enabled = No and Locked = Yes should work regardless of the control source of the text box: it shouldn't matter whether the text box is bound to a field, is calculated or has a blank control source.

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Disabling fields on forms (Access 2003)

    Actually I have an unbound text box on a form that has Enabled set to false and Locked set to true and tab stop set to false, and it still allowsme to click in the box and change the value.

    It is populated in the On Current event.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disabling fields on forms (Access 2003)

    Do you have conditional formatting set for this text box? That seems to play strange tricks with the Enabled property of a text box.

  9. #9
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Disabling fields on forms (Access 2003)

    Where do I check if conditional formatting is set for the text box?

    I inherited this database to be fixed.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disabling fields on forms (Access 2003)

    - Open the form in design view.
    - Select the text box by clicking on it.
    - Select Format | Conditional Formatting...
    - If everything under Condition 1 is blank, no conditional formatting has been set.
    - If a condition has been entered, and formatting has been set, you will notice it.

  11. #11
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Disabling fields on forms (Access 2003)

    Thanks Hans,

    No it doesn't have conditional formatting.

    Unless you have any other ideas, it seems like I will have to trap the OnGotFocus and go to the previous control that had the focus. How would I do this?

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disabling fields on forms (Access 2003)

    The code would look like

    Private Sub txtProblem_GotFocus()
    Screen.PreviousControl.SetFocus
    End Sub

    where txtProblem is the offending text box.

  13. #13
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Disabling fields on forms (Access 2003)

    It's ok, I found it in <post#=535990>post 535990</post#>, thank you. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  14. #14
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Disabling fields on forms (Access 2003)

    Is this the best solution for this scenario?

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disabling fields on forms (Access 2003)

    Personally, I would investigate if I could reproduce the problem in a newly created form. If not, I would suspect the problem form to be more or less corrupt, and I would copy all database objects except the form to a blank new database, and recreate the problem form from scratch.

Page 1 of 2 12 LastLast

Posting Permissions

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