0
votes

I have found an OLEDB Foxpro provider to connect to VFP tables in MS Access. I would like to switch the connection to be DSN less so all I have to do is have the customer install the OLEDB driver and not setup a DSN. What connection string would I use?

Here is the code I am using but it does not seem to work. It prompts me for an ODBC DSN when I run it.

    Set db = CurrentDb()
  tablecount = db.TableDefs.Count  '  Number of tables

  ' Loop through all tables, reattaching those with nonzero-length Connect strings.
  oldconnect = ""
  For i = 0 To tablecount - 1
    Set td = db.TableDefs(i)
    If td.Connect <> "" Then       'Connect is empty if local table
       Debug.Print td.Name, td.Connect
       td.Connect = "Provider=vfpoledb;Data Source=C:\Donor6\Data\"
       td.RefreshLink              'refresh link
    End If
  Next i
1
Please be clear about what you're asking. Linked tables in Access use ODBC, not OLEDB. Are you asking how to create a DSN-less linked table? Because I have a dupe for that.Erik A
To answer your question "as asked", all VFP Connect strings are at: connectionstrings.com/visual-foxproDhugalmac
I am asking how to create DSN-less linked tables. I know how to do this using SQL server but do not know how to do it using VFP. I used the connectionstrings.com site and got Provider=vfpoledb;Data Source=C:\MyDataDirectory\; but it does not work. I get a prompt for a DSN when I run it.Paul

1 Answers

0
votes

Use the connection string like:

Provider=VFPOLEDB;Data Source=c:\YourDataFolder

It just works.