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!

ODBC [Visual FoxPro Driver] Syntax error?

Status
Not open for further replies.
Oct 22, 2001
215
US
Hi,
I am trying to access a foxpro table using ADODB and am getting this error: ODBC Synttax error or Access Violation.

I do have an ODBC driver for this table, and noone else is opening this table. There should not be any access violation but...?
Can any one figure it out what am I doing wrong? TIA. Here is the code...

Set cnDb = New ADODB.Recordset
connStr = "Driver=Microsoft Visual Foxpro Driver; " + _
"UID=;SourceType=DBF; SourceDB = " & "c:\mytest\datafile.dbf"
cnDb.Open connStr

 
Thanks, pointing to the file path did help. I can open the connection without any trouble... I am facing another problem now, When I try to open a new recordset using my existing connection, I am getting error... wondering, for .source should I use the file name again or just path. Just path does not work... am I missing some thing?

connStr = "Driver=Microsoft Visual Foxpro Driver; " + _
"UID=;SourceType=DBF; SourceDB = " + path_fox
cnDb.Open connStr
cnDb.CommandTimeout = 0
Set rsDb = New ADODB.Recordset
With rsDb
.Source = path_fox
.ActiveConnection = cnDb
.Open
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top