Export table from Backend data file to new database (1 Viewer)

aqif

Registered User.
Local time
Today, 08:49
Joined
Jul 9, 2001
Messages
158
Hi

I want to simply export all the tables from my backend data file to the new database file I have created. When I try to run following code from my frontend, it sends the tables as linked table to the new database. I want this to actually export all the tables from backend file instead of frontend. Here's my code

Dim RealDB As DAO.Database
Dim MobileDB As DAO.Database
Dim strRealDataPath As String
Dim strMobileDBPath As String
Dim TDF As DAO.TableDef
Dim i, X

strRealDataPath = DLookup("Database", "MSysObjects", "Name Like 'TblPatients'")

Set RealDB = OpenDatabase(strRealDataPath)



'Start Exporting tables

For Each TDF In RealDB.TableDefs

If TDF.Name Like "MSys*" Then
Else


DoCmd.TransferDatabase transfertype:=acExport, databasetype:="Microsoft Access", _
databasename:=strMobileDBPath, objecttype:=acTable, Source:=RealDB.TableDefs(TDF.Name), _
destination:=TDF.Name

X = SysCmd(4, "Exporting Table " & TDF.Name)
Me.Repaint
End If
Next

X = SysCmd(acSysCmdClearStatus)


Any suggestions?
Aqif
 

Users who are viewing this thread

Top Bottom