Results 1 to 5 of 5
  1. #1
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134

    Checkbox default value problem

    Dear All,
    Am trying to set a checkbox when it should be ticked some text boxes will be dimmed. It's working perfect but there is a problem when opening the form for the first time - by default it's checked, I have to double click on it to remove the check to let me enter the data in the dimmed areas.
    It should be like that


    Click image for larger version. 

Name:	loaded.jpg 
Views:	23 
Size:	28.1 KB 
ID:	23335
    But actually when the form starts it's like that
    Click image for larger version. 

Name:	startup.jpg 
Views:	23 
Size:	35.2 KB 
ID:	23336
    here is my code

    Code:
    Private Sub Holiday_Click()    
    If Me.Holiday = True Then
        Me.WorkItems.Enabled = False
        Me.SubProject.Enabled = False
        Me.Hours.Enabled = False
        Me.ProjectID.Enabled = False
    Else
        Me.WorkItems.Enabled = True
        Me.SubProject.Enabled = True
        Me.Hours.Enabled = True
        Me.ProjectID.Enabled = True
    End If
    End Sub
    Last edited by June7; 01-08-2016 at 04:01 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,973
    Checkbox is bound to field? Does field have DefaultValue property set?
    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.

  3. #3
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134
    Quote Originally Posted by June7 View Post
    Checkbox is bound to field? Does field have DefaultValue property set?
    Yes it's bounded to field , But don't have default value

  4. #4
    Rivanni is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    9
    At the form load event set the enabled status of the text boxes based on the Holiday value.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Sorry, but this doesn't really make sense! First you say

    "...by default it's checked..."

    Then you say

    "...But don't (sic) have default value..."

    So, does it have a Default Value or not? If it doesn't have a Default Value...how do you expect it to have a Default Value?

    And, as Ravinni suggested, what happens when the Checkbox is ticked has nothing to do with what occurs when the Form opens! If the Form opens to a New Record, set the formatting as you want it, which, if I read it correctly, is having WorkItems, SubProject and Hours all disabled.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Continuous Form With Checkbox VB Problem
    By WhiskyLima in forum Access
    Replies: 4
    Last Post: 11-25-2013, 08:25 AM
  2. Checkbox problem if Yes or No
    By Amen in forum Access
    Replies: 3
    Last Post: 09-23-2013, 11:54 PM
  3. Default Value Problem
    By TheHarleygirl2005 in forum Forms
    Replies: 2
    Last Post: 09-03-2013, 11:55 AM
  4. Problem with my checkbox vba code
    By wrkadri in forum Programming
    Replies: 2
    Last Post: 12-13-2012, 02:12 AM
  5. saving default value to field problem
    By sk88 in forum Access
    Replies: 3
    Last Post: 01-08-2012, 01:15 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