Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - Update Query!

Status
Not open for further replies.

Caryisms

Technical User
Oct 17, 2001
132
US
What would be the best way to insert the same 10 records for ID's already input into a table?

ID 1 - 1
ID 1 - 2
ID 1 - 3
ID 1 - 4
ID 1 - 5
ID 1 - 6
ID 1 - 7
ID 1 - 8
ID 1 - 9
ID 1 - 10

ID 2 - 1
ID 2 - 2
ID 2 - 3
ID 2 - 4
ID 2 - 5
ID 2 - 6
ID 2 - 7
ID 2 - 8
ID 2 - 9
ID 2 - 10

etc.
 
I'm not entirely sure what you're trying to do here but had you considered entering the 10 values into a temporary table and then updating the main table with a select update?
 
Dan,

How would I go about that? Can you explain? Thank you.
 
Knock out a VBA module, incrementing a counter in a loop & using it in a run-time INSERT; something like:

Dim I As Integer, J As Integer, SQL As String

For I = 1 To <whatever>
For J = 1 To 10
SQL = &quot;INSERT INTO <table> (ID)&quot; _
& &quot;VALUES (&quot; & CStr(I) & &quot;-&quot; & CStr(J) & &quot;)&quot;
db.Execute SQL
Next J
Next I
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top