Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

insert into from list

Posted on 2013-02-01
5
286 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 143

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

839 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