Results 1 to 3 of 3

Thread: 'Path not valid' When trying to access dbf file remotely

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2016
    Location
    San Diego
    Posts
    16

    'Path not valid' When trying to access dbf file remotely

    Hello,

    I am writing a program which tests two tasks:

    1. open a dbf file which the user chooses with a common dialog, even if it's a remote computer (network)

    2. show the contents of that dbf file on a flex grid to see if the connection was successful.

    I got the first task down but when I try to get the program to open the dbf file it sends me an error saying the path is not found.

    I am assuming this is because the file is in a network computer and not local, but I would like to know why that happens and how I can fix it.

    Can you please help me? Thanks!

    Code:
    Private Sub llenarTabla()
        Dim cnFOX As ADODB.Connection
    Dim rsFOX As ADODB.Recordset
    Dim cmdtemp As Command, SQLText As String, r As Long
        Set cnFOX = New ADODB.Connection
        cnFOX.CursorLocation = adUseClient
        cnFOX.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & filepath & ";Extended Properties=DBASE IV;"
        Set rsFOX = New ADODB.Recordset
        Set cmdtemp = New ADODB.Command
        SQLText = "SELECT * FROM " & filename & ""
        cmdtemp.CommandText = SQLText
        cmdtemp.CommandType = 1 'SQL statement
        Set cmdtemp.ActiveConnection = cnFOX
        rsFOX.Open cmdtemp, , adOpenStatic
        If rsFOX.RecordCount > 0 Then
                    'Me.MSFlexGrid.Cols = 4
                    Me.MSFlexGrid1.Rows = rsFOX.RecordCount + 1
                    rsFOX.MoveFirst
                    r = 1
                    Do While Not rsFOX.EOF
                        Me.MSFlexGrid1.TextMatrix(r, 1) = rsFOX!Field1
                        Me.MSFlexGrid1.TextMatrix(r, 2) = rsFOX!Field2
                        Me.MSFlexGrid1.TextMatrix(r, 3) = rsFOX!Field3
                        r = r + 1
                        rsFOX.MoveNext
                    Loop
        End If
    End Sub

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: 'Path not valid' When trying to access dbf file remotely

    well... this is hte line:
    cnFOX.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & filepath & ";Extended Properties=DBASE IV;"

    so, what is filepath at the time that the error happens?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2016
    Location
    San Diego
    Posts
    16

    Re: 'Path not valid' When trying to access dbf file remotely

    Thanks for your reply.

    The file path at the time is "\\SERVER-PC\Folder\File.dbf"

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width