Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Link to FoxPro (2K, SP3)

    I checked this one out in the archives, but still can't quite seem to get it to work:

    I am trying to link through Access to a Visual FoxPro 7.0 database (fundraising software). I have followed every possible permutation of setting up the DSN through the ODBC administrator. I know that since it is a version 7 DB I should be pointing to the .DBC file. I have set it up as a User DSN as had been suggested in other threads. Still, no matter what I do, when I go to Access to link the tables, the link window is empty after I choose the DSN.

    Anyone solved a similar problem?
    -Karl

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Link to FoxPro (2K, SP3)

    See if the code posted by MarkD in <post#=174958>post 174958</post#> helps; it might be worthwhile to read the other posts in that thread too. And the question in <post#=117856>post 117856</post#> resembles yours.

  3. #3
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Link to FoxPro (2K, SP3)

    Hi Hans, and thanks for the reply.

    I've taken a look at <post#=117856>post 117856</post#>, and the problem there was that a VFP database (.dbc) was being set up as a free table directory, and I am pointing to the .dbc file and not trying to set it up as a table directory.

    MarkD's <post#=174958>post 174958</post#> seems to rely on a properly set up DSN, which mine doesn't seem to be, since if it was properly set up I should be able to link and wouldn't need that code, unless I'm misunderstanding what is happening. I think that my problem is in setting up the DSN, but I can't seem to locate what the problem would be. I've followed the instructions I found in Knowledge Base Article #197893 , but I still get that blank table screen.

  4. #4
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Link to FoxPro (2K, SP3)

    If you looked at some of my previous posts re VFP, when MS released VFP 7.0 they did not make the OLE DB Provider for VFP 7.0 available for download unless you purchased the product; it was not included in MDAC. However, for whatever reasons, the VFP 8.0 OLE DB Provider is available for download:

    Visual FoxPro 8.0 OLE DB Provider

    As test, downloaded & installed this provider on WIN 2K machine with ACC 2K and VFP 6.0 drivers installed - I do not have VFP 7.0 or 8.0 installed. (The installation includes a VFP 8.0 version of Northwind which I could not open for obvious reasons.) Using this provider, you can open an ADO connection to a VFP database, even if an earlier version of VFP. Example:

    Public Sub TestVFPOLEDBConnection()
    On Error GoTo Err_Handler

    Dim rst As ADODB.Recordset
    Dim cnn As ADODB.Connection
    Dim strSQL As String
    Dim strMsg As String
    Dim n As Long

    Set rst = New ADODB.Recordset
    Set cnn = New ADODB.Connection

    ' Open connection to VFP 6.0 .DBC database using VFP 8.0 OLE DB provider:
    With cnn
    .ConnectionString = "Provider=vfpoledb.1;" & _
    "Data Source=C:VFP_APPVFP_APP.dbc"
    .Open
    End With

    strSQL = "SELECT Field1, Field2 FROM Table1 " & _
    "ORDER BY Field1;"
    rst.Open strSQL, cnn, adOpenStatic, adLockOptimistic

    For n = 1 To rst.RecordCount
    Debug.Print n & ". " & rst!<!t>[Field1]<!/t>, rst!<!t>[Field2]<!/t>
    rst.MoveNext
    Next n
    rst.Close
    cnn.Close

    Exit_Sub:
    Set rst = Nothing
    Set cnn = Nothing
    Exit Sub
    Err_Handler:
    strMsg = "Error No " & Err.Number & ": " & Err.Description
    Beep
    MsgBox strMsg, vbExclamation, "ERROR MESSAGE"
    Resume Exit_Sub
    End Sub

    The code above successfully opened connection to VFP 6.0 db & printed data to Debug window. While this does not resolve issue of not being able to link tables directly via ODBC, it does provide an alternative method for accessing a VFP database w/o need to first define an ODBC DSN for the connection string. If worked with VFP 6.0 may work for VFP 7.0? For more info & further links, see MSDN VFP site:

    Microsoft Visual FoxPro 8.0

    HTH

  5. #5
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Link to FoxPro (2K, SP3)

    Mark,

    Thank-you. It looks like this works. I have some playing around to get this working, but I can see the data, so all is good. I am so grateful. I was so stuck with ODBC link...

    -Karl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •