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




Reply With Quote
