Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Foxpro dsnless linked tables

Status
Not open for further replies.

Dan Stoica

Programmer
Jul 4, 2024
1
RO
Hello!
I have a problem when i try to connect two different Foxpro table which are located in different folders. The first link goes fine but when i try to link the second table although in the ConnectionString I specify the path correctly (witch is different from the first path) i get an error. Apparently the ConnectionString in the moment when is appended to TableDef becomes the path of the first table (where the second table it is not).
Bellow is the code witch i used for dsnless link the table. I am pretty sure thet is correct (because the first table apear correct linked and opes in database window).

Set db = CurrentDb
Set tdf = db.CreateTableDef([table_name])
tdf.Connect = "ODBC;DRIVER={Microsoft FoxPro VFP Driver (*.dbf)};SourceDB=[path]" & _ ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
tdf.SourceTableName = [source_table_name]
db.TableDefs.Append tdf

What is wrong? What i can do to correct the error and to link multiple tables from diffrent locations?
Any help will be appreciated.
Thanks a lot in advance for your help.!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top