Solved

insert into from list

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

895 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

16 Experts available now in Live!

Get 1:1 Help Now