D
Dan Thomson
I have a database which contains 900 records that I'd like to export to
another database.
Both databases have the same tables and fields. The destination database
already contains data in the destination table that I do not want to
overwirte. I want to do something that supports all Access versions starting
with Access 2000.
Does any one have any thoughts on how to do this effectively?
Here is some code that works. I'm just looking to see if there is a better
way to do it.
' Define the name of the table to work with
strTable = "tblBogus"
' Create a reference to the destination table in the user's database
Set rstScripts = dbs.OpenRecordset(strTable, dbOpenDynaset)
' Go to the first record of the source table
DoCmd.RunCommand acCmdRecordsGoToFirst
' Loop through all records in the source table
For s = 1 To intRecordCount
With rstScripts
' Create the new record in the destination database
.AddNew
![Name] = Me![Name]
![Type] = Me![Type]
!
another database.
Both databases have the same tables and fields. The destination database
already contains data in the destination table that I do not want to
overwirte. I want to do something that supports all Access versions starting
with Access 2000.
Does any one have any thoughts on how to do this effectively?
Here is some code that works. I'm just looking to see if there is a better
way to do it.
' Define the name of the table to work with
strTable = "tblBogus"
' Create a reference to the destination table in the user's database
Set rstScripts = dbs.OpenRecordset(strTable, dbOpenDynaset)
' Go to the first record of the source table
DoCmd.RunCommand acCmdRecordsGoToFirst
' Loop through all records in the source table
For s = 1 To intRecordCount
With rstScripts
' Create the new record in the destination database
.AddNew
![Name] = Me![Name]
![Type] = Me![Type]
!
Code:
= Me![Code]
![Author] = Me![Author]
.Update
End With
If s = intRecordCount Then Exit For
' Go to the next record to be exported
DoCmd.RunCommand acCmdRecordsGoToNext
Next