coding command button to add a few new records to a table

complexx

Registered User.
Local time
Yesterday, 21:04
Joined
Dec 15, 2005
Messages
64
I have 2 tables, one has a list of comments indexed by numbers.

The second table will be populated with numbers that correspond to the first table based on usage of the form that I'm about to describe.

The form contains several check boxes. Each corresponds to a comment from the first table. If 3 of the check boxes are selected when the command button is pressed, I want three separate new record entries to go into the second table and the data that I want entered is the text in the label that is next to each check box on the form. After the records are added to the table, I'd like to reset the check boxes.

I simply cannot figure out how to code the button to do this.
 

Attachments

I think anyone who looks at your DB is going to need a little more to go on.... You have what looks like rating value in table one.. And on your form you have checkboxes....... The checkboxes would either be "True" or "False".... Checked or not checked.
Now if your rating something I think an option group would be better suited.
As for storing your text from the label...... Why? You are picking the value... This is attached to your text field. There is no need to store it a second time.
I would re-think your design..... Put a bit more info on your form, this would let people know where you are going with this.... Then post it again.
 
*Edit Shortened the explanation

Thank you for responding. I haven't been clear.

The database is a service report database. This is a small portion related to picking and storing comments for each service visit.

You can ignore the "Comments" table. All you really have to look at is the form and the Service Record Comments table.

All I want this to do, is for every check box that is checked, I want a new record added to the Service Record Comments table. Each record will contain one of the values in the text boxes next to the check box. The algorithm is stated below.

In the command button "on click" I would like to following to be performed.

If Check1 is selected
add a record to the "Service Record Comments" table with the Comment field = Text1 <--- Text1 = 1
else
don't add a comment and skip to the next check box

If Check2 is selected
add a record to the "Service record COmments" table with the Comment field = Text2 <--- Text2 = 2
else
don't add a comment and skip to the next check box

etc.


So if the first 3 check boxes are selected. The Service Record Comments table should have 3 new records, one of them contains a value of 1, the next a value of 2, and the third a value of 3.

After, I'd like to reset all the check boxes to false.
 
Last edited:
bump

I tried to describe what i need to do more clearly in the post above
 

Users who are viewing this thread

Back
Top Bottom