Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old May 15th, 2006, 08:55 PM
Donald Grove
Guest
 
Posts: n/a
Default importing .dbf or opening with ado

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?
  #2  
Old May 16th, 2006, 12:35 AM
Rich P
Guest
 
Posts: n/a
Default 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 ***
  #3  
Old May 16th, 2006, 12:45 PM
Donald Grove
Guest
 
Posts: n/a
Default 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]
  #4  
Old May 16th, 2006, 08:15 PM
Rich P
Guest
 
Posts: n/a
Default 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 ***
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.