Inserting A Record Set
Hey Guys,
Is there any way to insert a recordset from vba into an access table without doing it one insert at a time? This is how I am doing it now:
While Not rsData.EOF
strqry = " insert into " & TableName & "(Telephone, Marked) " & _
" values ('" & rsData("Telephone") & "'," & _
" " & rsDataMarked") & ")"
rsAction.Open (strqry)
rsData.MoveNext
wend
//rsData is my record set that contains my data.
I want to do something like this:
strqry = " insert into tbl_ImportedList (Telephone)" & _
" select tbl_txtFormat.phone" & _
" FROM tbl_txtFormat"
rsInsert.Open (strqry)
In this query, I am inserting everything from table tbl_txtFormat into table tbl_ImportedList in one shot without a loop. Is it possible to insert an entire recordset into a table with one query (ie. without a loop)? The way my code is now takes too long to process looping through insert statement after insert statement. Any information will really help me out. I have been wrestling with this for some time now.
Thanks,
Ryan
nikotromus
__________________
nikotromus
|