How to insert data into multiple rows in a table containing same text in Microsoft Access

Viewed 27

suppose I want to add a value from form textbox to table rows where all rows containing same DuNumber in ms Access. If I use criteria it only insert value to first row containing same duNumber. But I want to add that value to all rows with same duNumber.

1 Answers

You using the term "insert" in a very confusing way here.

You have:

I want to add a value from form textbox to table rows where all rows containing same DuNumber in ms Access.

So, your sql should look like:

strSQL = "UPDATE MyTable SET MyColum = @MyValue WHERE DuNumber = @DuNum"

if many rows have that same DuNumber, then all such rows will and should get updated.

But, you then introduce the concept of "inserting". are you talking about inserting new rows, or putting a value into a column?

Related