Storing the selected Checkbox option in the MS Access Database. (1 Viewer)

Premlatha Raghunath

Registered User.
Local time
Yesterday, 19:49
Joined
Aug 13, 2019
Messages
11
Hi,


How can I store the value of the selected checkbox option in the Ms Access Database?

I had a Combo Box in my form as it's shown in the image. I'll have to change it to Checkbox like it's shown below the Combobox. The options in both checkbox and the combobox are same. If an option is selected from the Combobox, the value is getting stored in the database but it's not getting stored when I select the checkbox option. Should I have to create fields in table for each option mentioned in checkbox and specify the type as Yes/No? or is there any other way?
 

Attachments

  • Image.png
    Image.png
    1.8 KB · Views: 110

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:49
Joined
Oct 29, 2018
Messages
21,453
Hi. You said the values are the same between the combo and checkboxes. Does that mean they should be stored in the same field in your table? If so, you could use an Option Group for the checkboxes and bind it to the same field as the combobox.
 

Premlatha Raghunath

Registered User.
Local time
Yesterday, 19:49
Joined
Aug 13, 2019
Messages
11
No, I don't want the combobox. Instead of combobox, I'm asked to change it to checkbox. When the user selects a checkbox option, the value should get stored in the MS Access. How do i do that?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:49
Joined
May 7, 2009
Messages
19,231
like what was said, use Option Group control instead of individual checkboxes.
add the field you want the value of your Option Group to be saved to your table.
set it's Visible property to No, on design view.

in the AfterUpdate event of your Option Group add code:
Code:
Private Sub OptionGroup1_AfterUpdate()
Select Case [OptionGroup1].Value 
    Case =1 
        Me.fieldFromTable = "what value you want to save"
    Case =2
        Me.fieldFromTable = "another value here"
    ...
    ...
End Select
End Sub
 

Users who are viewing this thread

Top Bottom