News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Name:Alex Dybenko

Location:Moscow, Russia

Saturday, October 01, 2011

How to link FoxPro tables

In Access 97 FoxPro ISAM was included in setup, and linking FoxPro table was as easy as Access or DBF table. It was even a nice fox icon to linked FoxPro table:


Then it was deprecated in Access 2002 (or 2000?), and now you can only connect using ODBC.

First you need to install Visual FoxPro ODBC Driver. Then try to create new DSN to some FoxPro table using ODBC Data Source Administrator. If it works – you can link FoxPro table to Access database.

Following code shows how to create linked table using VBA:

Set tdf = dbs.CreateTableDef(strTableName, 

   _ dbAttachExclusive,

   _ strFileName,

   _ "ODBC;DSN=Visual FoxPro Tables;SourceDB=" & strFolder &

   _ ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;" &

   _ "Collate=Machine;Null=Yes;Deleted=Yes;" &

   _ "TABLE=" & strFileName)

dbs.TableDefs.Append tdf dbs.TableDefs.Refresh



Anonymous Sylvain said...

Thanks Alex,
Is there any way of linking a FoxPro table without having to setup the DSNs on each user machine?
I am looking about a solution which is DSN-less.
I tried "ODBC;DRIVER={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=...." but got an error message when trying to append the new linked table.

Do you have any suggestion??
Thanks in advance

10:01 AM  
Blogger Alex Dybenko said...

Hi Sylvain,
when i install Visual FoxPro ODBC Driver i did not add any DSN, i just made new one manually to test connection.

2:07 PM  
Anonymous Sylvain said...

Thanks Alex,
In your example you are still refering to a DSN which seems to make the difference.
Removing the DSN parameter and adding the Driver one instead with Driver={Microsoft Visual Foxpro Driver} does not work for me.
Really frustating...

4:58 AM  
Blogger Alex Dybenko said...

Sylvian, i see your frustration, but this DSN was added during driver installation, so you dont need to setup DSN on each PC, you need to install driver.
Anyway - if you find dsn-less connection string - pls post here.

9:40 AM  

Post a Comment

<< Home