Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read a .dbf file

Status
Not open for further replies.

sunny84

Programmer
Jan 5, 2011
5
BH
Hello,

I need to read data from a .dbf file. i am trying to take data from the dbf file and inserting it into a ADO recordset.
Dim dbfConn As ADODB.Connection
Dim rs As ADODB.Recordset

Set dbfConn = New ADODB.Connection
Set rs = New ADODB.Recordset
dbfConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & ";Extended Properties=dBASE IV;User ID=Admin;Password="

rs.Open "select * from arreceipt.dbf", dbfConn, adOpenStatic, adLockOptimistic

I m getting error:
The Microsoft Jet database engine could not find the object 'arreceipt.dbf'. Make sure the object exists and that you spell its name and the path name correctly.

Can anyone help me in resolving this problem or suggest any other way to read the DBF file.

Thanks
AV
 
You need dbf file defined in the connection string, assuming it's in App path:
[tt]dbfConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\"arreceipt.dbf";Extended Properties=dBASE IV;User ID=Admin;Password="[/tt]
A table name should be in the sql:
[tt]rs.Open "select * from arreceipt", dbfConn, adOpenStatic, adLockOptimistic[/tt]



combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top