How do you code a check box to insert data into a table?

D

Dirk Goldgar

It's better to post the details of your question in the body of the
message. Then you can give more information, which is definitely needed
in this case.

What do you mean? You can use a check box's Control Source property to
bind the control to a field (normally a Yes/No field) in your form's
recordsource table, so clicking on the check box toggles the field
between True and False values. If you mean something other than that,
you'll have to explain what you have in mind.
 
W

wayne7777

I am trying to use a check box so that when you check the box a value is
entered into the field of the table example if chkbox = yes then
table.field = 1777
 
D

Dirk Goldgar

wayne7777 said:
I am trying to use a check box so that when you check the box a value
is entered into the field of the table example if chkbox = yes then
table.field = 1777

Here's an example of an event procedure to do what you describe,
assuming that the field to be updated is also part of the form's
recordsource. I don't know whether you want to do something if the
check box is *un*checked.

'----- start of example code -----
Private Sub chkMyCheckBox_AfterUpdate()

If Me!chkMyCheckBox = True Then
Me!SomeField = 1777
Else
' do something in this case?
End If

End Sub
'----- end of example code -----
 
W

wayne7777

Thanks for the tip. Now how do you handle 50 checks boxs all referring to the
same field in the same table in the same form, trying to enter different
values in one session?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top