1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Locking fields in Access

Discussion in 'Business Applications' started by gurutech, Apr 11, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. gurutech

    gurutech Thread Starter

    Joined:
    Apr 23, 2004
    Messages:
    2,960
    I have a database, and I already have several fields "locked" so that chances cannot be made to these particular fields.

    I have some command buttons that I currently have enabled, but would like to disable them when a certain checkbox has a "true" value (is checked).

    How can this be done (if at all) on a "per button" basis, as I have some other buttons that I want to leave enabled all the time.

    Thanks in advance!
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    gurutech, you can either disable or disappear them.

    me.buttonname.Enabled = False

    disables and greys out the button

    me.buttonname.Visbile = False

    makes the Button disappear all togther.

    Where buttonname is the actual name of your button.
    Using True instead of False brings them back again.
     
  3. gurutech

    gurutech Thread Starter

    Joined:
    Apr 23, 2004
    Messages:
    2,960
    So I can do something like this?:

    If Me.FieldName.Value = True
    Then Me.ButtonName.Enabled = False
    Else Me.ButtonName.Enabled = True

    And put this under the "General Declarations" section?
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    I would instead put it in the Check Box Field's After Update Event and in the Form's "On Current" event Procedures.
    That way when the field value is changed it gets picked up and also if you go on to a new record that already has the check box ticked it will be disabled.
    I think that you will find that VB might react better to
    If Me.FieldName.Value = -1
     
  5. gurutech

    gurutech Thread Starter

    Joined:
    Apr 23, 2004
    Messages:
    2,960
    Would the -1 be considered "true" or "false" ?
     
  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    -1 is ticked and 0 is unticked.
     
  7. gurutech

    gurutech Thread Starter

    Joined:
    Apr 23, 2004
    Messages:
    2,960
    Awesome! Thanks! (It works, BTW...)
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Of course it does. (y)
    But you made it do it.
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/560678

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice