Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Location
    Orange County, CA
    Posts
    5

    Unanswered: Lock a checkbox based upon time of day

    I have the code written to check the day/time, all I need is simply the code to lock a checkbox located in a form.

    Seems simple enough...right?

    If format(time,"HH") > 16 then <<INSERT LOCK CODE HERE>>

    Any insight?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You want to toggle the "enabled" property.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jan 2010
    Location
    Orange County, CA
    Posts
    5

    There inlies my problem.

    What is the code to toggle this object's enabled property.

    me.checkbox1.enabled = false

    ?

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I'd use Locked and Enabled Properties, like this:
    Code:
    Private Sub Form_Current()
     If Format(Now, "hh") > 16 Then
      Me.CheckBox1.Locked = True
      Me.CheckBox1.Enabled = False
     Else
      Me.CheckBox1.Locked = False
      Me.CheckBox1.Enabled = True
     End If
    End Sub
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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