Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Posts
    40

    Angry Unanswered: Check boxes in MSAccess

    I am trying to write an IF THEN statement to a form in Access. I want by checking a checkbox, another checkbox becomes enabled. I have done this in VB, but I keep getting an error in Access. Here is the code I am using:

    If Checkbox1.Checked Then
    Checkbox2.Enabled = True
    End If

    The code errors out when it reads the Checked area. Why???

  2. #2
    Join Date
    Mar 2004
    Location
    Netherlands
    Posts
    100

    Re: Check boxes in MSAccess

    Originally posted by reallen
    I am trying to write an IF THEN statement to a form in Access. I want by checking a checkbox, another checkbox becomes enabled. I have done this in VB, but I keep getting an error in Access. Here is the code I am using:

    If Checkbox1.Checked Then
    Checkbox2.Enabled = True
    End If

    The code errors out when it reads the Checked area. Why???
    Try with Checkbox.Value = True instead of Checkbox.Checked

  3. #3
    Join Date
    Dec 2003
    Posts
    40
    Do you think I should day True or -1 since that is the value written to the database?

  4. #4
    Join Date
    Mar 2004
    Location
    Netherlands
    Posts
    100
    Originally posted by reallen
    Do you think I should day True or -1 since that is the value written to the database?
    I think True is the right value, I do like that.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by reallen
    Do you think I should day True or -1 since that is the value written to the database?
    It's a matter of personal preference.

    .Value is the implicit default when you call the checkbox, my personal preference is to keep it short:

    If MyCheckBox = -1 Then
    etc

  6. #6
    Join Date
    Dec 2003
    Posts
    40
    I tested it woth the numbers and that worked, thanks for your help.

Posting Permissions

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