Information générale
Titre:
Linking Foxpro free tables using ODBC in Access 2000
I am attempting to programatically link a number of Foxpro tables into an access database but can't get the code to work.
I have a system DSN set up for Foxtables1.
I am running Office 2000 Premium on Windows 2000
Doing a manual Get External Data, Link Tables works with no problem
Code is as follows:
Function linkfox()
Dim datapath, filepath, myname, filenam, dpoint, rv, ConnxStr
datapath = getpath() ' Returns directory containing tables
filepath = datapath & "\*.dbf"
myname = Dir(filepath) ' Retrieve the first entry.
Do While myname <> "" ' Start the loop.
dpoint = InStr(myname, ".")
filenam = Mid(myname, 1, CLng(dpoint) - 1) ' Strip off file extension
' Build the ODBC connect string
ConnxStr = "ODBC;DSN=FoxTables1;UID=;SourceDB=" & datapath _
& ";SourceType=DBF; _
& Exclusive=No; _
& BackgroundFetch=Yes; _
& Collate=Machine; _
& Null=Yes; _
& Deleted=No;; _
& TABLE=" & filenam
DoCmd.TransferDatabase acLink, "ODBC", ConnxStr, acTable, myname, filenam
myname = Dir ' Get next entry.
Loop
rv = SysCmd(acSysCmdClearStatus)
End Function
I would appreciate any suggestions.
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement