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!

Using fox pro tables in VB6

Status
Not open for further replies.

baggio7

Programmer
Jun 23, 2004
14
0
0
CA
Hi, i would like to know if anyone can send me an exmple of code that will take the info of a foxpro .dbf table and put it in a listBox. Also, what are the references that i have to add to vb to make it work??

Thanks
 
Check out faq222-2244 to see how to get the best from these forums - read carefully.

For this question:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
' Add a reference to Microsoft ActiveX Data Objects X.X Library

Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Old Drive\;Extended Properties=dBASE 5.0;User ID=Admin;Password="

rs.Open "SELECT * FROM Setups.dbf", conn, adOpenForwardOnly, adLockReadOnly

Do Until rs.EOF
List1.AddItem rs.Fields("State").Value
rs.MoveNext
Loop

rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing

End Sub

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top