Export table from Backend data file to new database

aqif

Registered User.
Local time
Today, 14:35
Joined
Jul 9, 2001
Messages
158
Hi

I am trying to export all the tables from my backend data file to a new database I have created. At the present moment it is only exporting the tables from frontend as linked table. I want it to actually export entire tables from backend data file.

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
Dim FS As FileSystemObject
'Set FS = CreateObject("Scripting.FileSystemObject")

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

Set RealDB = OpenDatabase(strRealDataPath)


strMobileDBPath = GetFileName2(strRealDataPath, "FileDirectory") & "\BCR_Mobile.mdb"


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

Back
Top Bottom