Hi All,
I am using Access 2000.
I would like to streamline this code by using a variable for the column
name. I have three tables with 255 columns each that I would like to
populate with the data from one table that has 1 column. Each of the
three tables will each up with 1 record with 255 columns. This is the
code I wrote (in brief) to demonstare whate I want to do. Is there an
easier way? I don't really want to type 500 lines of code for each
table!
Thanks,
Kathy
Public Sub CopyDataToRecipeTables()
Dim rsMain As ADODB.Recordset
Dim rsTable As ADODB.Recordset
Dim strMain As String
Dim strTable As String
Set rsMain = New ADODB.Recordset
Set rsTable = New ADODB.Recordset
strMain = "Select FIELD1, RowID From RecipeData"
strTable = "Select * FROM Recipe1"
rsMain.Open strMain, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
rsTable.Open strTable, CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
rsTable.AddNew
rsTable!Field1 = rsMain!Field1
rsMain.MoveNext
rsTable!Field2 = rsMain!Field1
rsMain.MoveNext
rsTable!Field3 = rsMain!Field1
rsMain.MoveNext
rsTable!Field4 = rsMain!Field1
rsTable.Update
End Sub
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!