Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2011
    Posts
    3

    Question Unanswered: CheckBox in VB Updates CheckBox in Access Database

    VB2010: Form with checkbox
    Access2010: Table with Checkbox

    I have created a form in VB that has a checkbox that I would like to use to update a field in a Access table. I've connected the database and have all the datasets and such but I am not sure what the code is to udpate the database for a checkbox. I've got all the textboxes updating the database I used the bindingnavigator for these but not sure what to use for the checkbox.

    Private Sub OccupiedCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OccupiedCheckBox.CheckedChanged

    End Sub

    Any direction on this matter would be most appreciated.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    So this is a question about Visual Basic, not about Access?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2011
    Posts
    3
    Yes, I would like to be able to code the checkbox on the VB form to update the Access database checkbox.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    no such thing as an Access database, Access is a RAD tool that talks to virtually any database out there, ranging from its own default format (confusingly called JET) to server products such as DB2, Oracle, SQL Server and so on. Im guessing you mean you are suign a JET database.

    JET doesn't support a 'checkbox' directly, but does use the boolean datatype which can be mapped to a checkbox or other display mechanism.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Oct 2011
    Posts
    3

    Question

    Ok, so how do I map this checkbox the the database created in Microsoft Access?

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    the check box control has a value, which is going to be effectively a boolean value
    its checked or not checked
    so assign the value of the control to the relevant column in the database and do an update as you would with other controls mapped to specific column.

    to set the control set the value of the controls relkevant property to the value fo the boolean column.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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