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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data base conection 1

Status
Not open for further replies.

NiteCrawlr

Programmer
Mar 16, 2001
140
BR
I'm sorry.... I'm kinda new in VB.
I need to make a conection with a Access DB from a VB application.
I don't have the least idea on how to make this.

I'll be very thankfull for any kind of help

Thanks in advance

Frederico
 
Providing you are using the Jet engine... set a referrence to Jet DAO 3.51 or 3.6. Then use/modify the following code:

Code:
Dim db As Database, rs As Recordset

Set db = OpenDatabase("C:\ABC\DEF.mdb")
Set rs = db.OpenRecordset("SELECT * FROM tblClients")

If Not (rs.RecordCount = 0) Then
    rs.MoveFirst
    MsgBox rs![fldFirstName]
End If

rs.Close
Set db = Nothing
Rob Marriott
rob@career-connections.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top