Results 1 to 6 of 6

Thread: Update a checkbox?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353

    Update a checkbox?

    How do you update a checkbox? This is what I have, but it doesn't work:

    Code:
            Update_tblCapRec = "UPDATE tblCapRec SET InGDB = cbInGDB.Checked WHERE CaseNumber='" & txtCaseNum.Text & "'" & " AND PartNumber ='" & txtPartNum.Text & "'"
    Thanks!

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    What is the datatype of InGDB?

    Regardless, you need to concatenate the vaule of the CheckBox to the SQL string, like you do for the Case and Part Numbers.


    Update_tblCapRec = "UPDATE tblCapRec SET InGDB = " & cbInGDB.Value & " Where ....

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353
    .Value doesn't work and neither does this:

    " & cnInGDB.Checked & "

    What else can I do?

    Code:
            Update_tblCapRec = "UPDATE tblCapRec SET InGDB = " & cbInGDB.Checked & " WHERE CaseNumber='" & txtCaseNum.Text & "'AND PartNumber ='" & txtPartNum.Text & "'"
    What other things could it be?

    .CheckState???

    HELP! Thanks!

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353
    .CheckState works perfect! Thanks!

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Do you understand why CheckState works but not Checked.

    Or do you even care?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353
    I think one equals a value of 1 or 0 and the other True or False. Is that right? That is what it said when I was debugging.

Posting Permissions

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



Click Here to Expand Forum to Full Width