|
-
Jul 14th, 2001, 07:58 PM
#1
Thread Starter
Junior Member
add fields to table from recordset
I have two tables with the exact same structure, one table has customer info. in it and the other one is empty. What I have done is created a recordset to hold info from the customer table based on search material supplied by the client. I now want to be able to fill in all the selected records to the temp table but would like to do it without having to list every field in an Insert Into statement because there are like 50 fields.
Can I some how make a statement like "Insert Into tempTable * objrs" because I'm going to be filling in every field.
This would be so much more easier, and I'm sure its possible, but I can't figure it out.
Thanks...
-
Jul 14th, 2001, 08:47 PM
#2
You can do something like the following:
Code:
Dim objField As ADODB.Field 'or just "Field" if DAO
Dim strFieldName As String
Do Until Recordset1.EOF
For Each objField In Recordset1.Fields
strFieldName = objField.Name
Recordset2.AddNew
Recordset2.Fields(strFieldName).Value = objField.Value
Next
Recordset2.Update
Recordset1.MoveNext
Loop
"It's cold gin time again ..."
Check out my website here.
-
Jul 15th, 2001, 10:56 AM
#3
Thread Starter
Junior Member
Thanks Bruce but I wanted to know if there was a sql statement that I could use. I already knew how to do it with a recordset object, but I'd like to avoid creating another one if possible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|