Connecting Tech Pros Worldwide Forums | Help | Site Map

importing .dbf or opening with ado

Donald Grove
Guest
 
Posts: n/a
#1: May 15 '06
I need to get data from a table in .dbf format. I try importing it,
but get "external table not in expected format".

So I tried this VB code to see if I could get at my records with ADO
(which I am very new to)

"
With cnn1
..Provider = "microsoft.jet.oledb.4.0"
..Open "dBase
IV;HDR=NO;IMEX=2;DATABASE=C:\projects\leshrc\urs;T ABLE=needlx#dbf"
End With

With rst1
..ActiveConnection = cnn1
..CursorType = adOpenDynamic
..CursorLocation = adUseClient
..LockType = adLockOptimistic
..Open strSQL
End With

"
and I got the same "external table not in expected format"

so I poked around the internet, and it said this is probably because
the table is in a higher version of foxpro. I learned I should
download and install the MS foxpro data provider, which I did. I
tried the same thing with the same Error.

Then I tried changing provider to

"
With cnn1
..Provider = "Provider=VFPOLEDB.dll"
..Open _
"dBaseIV;HDR=NO;IMEX=2;DATABASE=C:\projects\leshrc \urs;TABLE=needlx#dbf"
End With
etc
"

This time I got "Provider cannot be found. It may be improperly
installed"

Are there steps I am missing? How do I get at the data in that table?

Rich P
Guest
 
Posts: n/a
#2: May 16 '06

re: importing .dbf or opening with ado


Hi Donald,

You can create an ODBC DSN in Control Panel/Administrative
Tools/DataSources (ODBC). Make sure to select the System tab. You want
to create a System DSN. This will support the DBF format. When you
click Add and get the list of ODBC drivers, Microsoft has one for Dbase
tables (DBF). Then you can connect to your table through ODBC.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Donald Grove
Guest
 
Posts: n/a
#3: May 16 '06

re: importing .dbf or opening with ado


Still having no luck.Still getting "external table not in expected
format" I also downloaded and installed the visual foxpro ODBC driver
but that doesn't change it.

When I create the connection, what should I call the Provider?




On Mon, 15 May 2006 23:31:24 GMT, Rich P <rpng123@aol.com> wrote:
[color=blue]
>Hi Donald,
>
>You can create an ODBC DSN in Control Panel/Administrative
>Tools/DataSources (ODBC). Make sure to select the System tab. You want
>to create a System DSN. This will support the DBF format. When you
>click Add and get the list of ODBC drivers, Microsoft has one for Dbase
>tables (DBF). Then you can connect to your table through ODBC.
>
>Rich
>
>*** Sent via Developersdex http://www.developersdex.com ***[/color]
Rich P
Guest
 
Posts: n/a
#4: May 16 '06

re: importing .dbf or opening with ado


It may be possible that you don't have a good file. Try opening your
file with Excel. I have never had a problem opening a DBF table in
Access. One other thing you could try is just linking directly to the
DBF file from Access like you would any other Access DB from the table
window -- r-click in the database window (Table Tab), select "Link
Tables". In the drop down you have like 4 different DBF format types
you can choose from. Try any of those. If that doesn't get it, and you
can't open the file in Excel, then the file may not be a good fie.
Lastly, if you have access to the original native environment where this
file was created you should be able to open it there for sure - if not,
then the file is corrupt.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Closed Thread