I've done programs to save values to a dbase from a certain control, but done one by one.

Scenario:

  • There are 7 textboxes where values are entered.
  • There are also 7 rows (but in one column only) for each values when save button is clicked.

Problem:

  • How to save values from each textbox to their respective rows based on a category (i.e. gender or ID number) ?

Here's my code - so far

.Open "Select * from Tabulation where Gender = " & lblmale.Caption, db, adOpenKeyset, adLockPessimistic
                .AddNew
                .Fields("Jeans_M").Value = txtm1.Text
                .Fields("Jeans_M").Value = txtm2.Text
                .Update
                MsgBox "Data successfully save.", vbInformation, "Information"

            .Close

But honestly, this would just put the values from the 2 textboxes in a random row on the Jeans_M column.

Code snippets will do just fine (but better with explanation)
Thanks.

There are also 7 rows (but in one column only) for each values

Coloumn of what? not sure what you are reffering to here..
How do you go about setting the random allocation?

I'm not sure what you require to do, please give me more info Abe. :)

Ok.

Say i have this column in a table in my database:

IDNo - the category where I would base
Score - where the value from a textbox would be saved.

My textbox number corresponds to the record on column IDNo.
i.e textbox1 corresponds to the first record on column Idno, textbox2 is to the second record and so on.

But the value of the textboxes is saved on the column score which also refers to the number on column IDNo.
So, if my textbox1 value is 10 and textbox2 is also 5, then on my DB appears:

IDNo        Score      

1             10           - from textbox1
2             5            - from textbox 2

Edited 4 Years Ago by abelingaw

if you say coloumn, are you talking about a field in your table? I'm still confused on how to get coloumn to a recordset in a table together... :)

if there are 7 rows there is going to need to be 7 addnews one for each row with an id of 1 2 3 etc and scores from each text box.

also you might like to consider using SQL INSERT statement to insert the rows rather than an addnew.

This article has been dead for over six months. Start a new discussion instead.