Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Feb 2004
    Location
    Jacksonville, Florida
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code to not allow editing (9.0/2000)

    In a form we're trying to build, we have individual check boxes. As you check the box, it links to calculations and inputs dates. We want to create a code against the checkbox (called Start_Task) that once you check the box you can not uncheck it. That way out database dates don't begin conveniently changing. Is there any way of doing this?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Code to not allow editing (9.0/2000)

    All you need do is use the AfterUpdate event of the checkbox to check whether the control is true or false and lock it accordingly. Something like this should work:

    Me!Start_Task.Locked = (Me!StartTask=True)

    Note that this assumes you're using a single form, not continuous, and the the controls are not unbound. If they're unbound, you would also need code in the Current event to unlock the checkbox.
    Charlotte

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Code to not allow editing (9.0/2000)

    Yes, you're right. I was mixing two different things in my mind and only the overflow made it to the keyboard. <img src=/S/nuts.gif border=0 alt=nuts width=15 height=15>
    Charlotte

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

    Re: Code to not allow editing (9.0/2000)

    Wouldn't you need code in the On Current event to lock/unlock the check box as you move from record to record for a bound control too?

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

    Re: Code to not allow editing (9.0/2000)

    You have put the line of code in Complete_Task_AfterUpdate, but it should be in Start_Task_AfterUpdate instead (at the bottom of your screenshot, just above the last End Sub). Note: the instruction should look like this:

    Me!Start_Task.Locked = (Me!Start_Task = True)

    You should also put the instruction in the On Current event of the form:

    Private Sub Form_Current()
    Me!Start_Task.Locked = (Me!Start_Task = True)
    End Sub

  6. #6
    Star Lounger
    Join Date
    Feb 2004
    Location
    Jacksonville, Florida
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code to not allow editing (9.0/2000)

    (Edited by HansV to replace huge screenshot by smaller version that doesn't cause horizontal scrolling.)

    We already have a code put in place in the After update section, could you advise us on where to place this code? We tried putting it after the "end if" and nothing happened.
    Attached Images Attached Images
    • File Type: jpg x.jpg (22.9 KB, 0 views)

Posting Permissions

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