General information
Title:
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.
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only