netmergence
asked on
Using VB in MS Access to Insert Multiple Rows from a Query into a Table
I need to be able to insert muliple rows returned by a query into a seperate table, using VB code.
ie, when I click a button, it executes the query in the background. The query returns somewhere between 2 - 10 lines, each of which need to be inserted into a seperate table.
I have tried using DoCmd.RunSQL and Insert Into, but I can't seem to get it to work. (I assume I can only insert one row at a time using this.)
I was thinking about executing my query into a 2D array, then inserting each line into the database one at a time, but I wonder if there isn't an easier way.
Any ideas?
ie, when I click a button, it executes the query in the background. The query returns somewhere between 2 - 10 lines, each of which need to be inserted into a seperate table.
I have tried using DoCmd.RunSQL and Insert Into, but I can't seem to get it to work. (I assume I can only insert one row at a time using this.)
I was thinking about executing my query into a 2D array, then inserting each line into the database one at a time, but I wonder if there isn't an easier way.
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.