• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

insert into from list

i have a list generated from a form and need to insert 1 record per value.
eg (10,20,30) how would I insert this into tableA with the values added into the field Quantity.

any ideas to get me started?
0
Shawn
Asked:
Shawn
  • 2
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You'll have to run each INSERT statement separately:

Dim i As Integer
Dim arr() As String

arr  = Split(YourList, ",")

For i = 0 to Ubound(arr)
  Currentdb.Execute "INSERT INTO TableA(Quantities) VALUES(" & arr(i) & ")"
Next i
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the question is: what exactly do you need help with?
* inserting "a" record?
* splitting the list into values so you could run the insert one by one?
0
 
ShawnAuthor Commented:
* splitting the list into values so you could run the insert one by one?
yes :)
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The code I provided will work to do that.
0
 
ShawnAuthor Commented:
thanks Scott. Worked great.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now