Results 1 to 2 of 2
2001-09-28, 19:51 #1
- Join Date
- Jul 2001
- Thanked 0 Times in 0 Posts
importing tables from external DB (Access 2000)
importing tables from external Db by code
I have a very good routine for linking tables to an external database.This is not a mine function,i have copied it from a book.
I am linking only the user tables,not system tables,,through the definition
Tbl.Attributes = 0.
What i want is to carry out an import instead of linking the tables. After several attempts i had no success,it waws a difficult job.Can someone help me in modifying the code for linking the tables into a code for importing the tables?
The working code for linking which i want to modify is the following
Public Function LinkAllTables(dbName)
Dim FrontDB As DAO.Database,BackDB As DAO.TableDef
Set FrontDB = CurrentDB
Set BacikDB = OpenDatabase(dbName)
For each Tbl in BackDB.TableDefs
If Tbl.Attributes = 0 Then
Set Lnk = FrontDB.CreateTableDef(Name:=Tabl.Name)
Lnk.SourceTableName = Tbl.Name
Lnk.Connect = " ; DATABASE = " & BackDB.Name
Can someone help me in modifying the above code so that it imports the use4r defined tables instead of linking them?
2001-09-29, 00:14 #2
- Join Date
- Dec 2000
- Sacramento, California, USA
- Thanked 1 Time in 1 Post
Re: importing tables from external DB (Access 2000)
Lookup up TransferDatabase in on-line help. The statement will be something like this for each table:
<pre> DoCmd.TransferDatabase TransferType:=acImport, _
DatabaseType:="Microsoft Access", _
Where strTblName is a variable holding the name of each table you want to import.Charlotte