Solved

insert into from list

Posted on 2013-02-01
5
256 Views
Last Modified: 2013-02-01
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
Comment
Question by:Shawn
  • 2
  • 2
5 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 38843215
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
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38843216
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
 
LVL 1

Author Comment

by:Shawn
ID: 38843229
* splitting the list into values so you could run the insert one by one?
yes :)
0
 
LVL 84
ID: 38844195
The code I provided will work to do that.
0
 
LVL 1

Author Closing Comment

by:Shawn
ID: 38844744
thanks Scott. Worked great.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now