View Single Post
  #2 (permalink)  
Old February 9th, 2007, 09:59 PM
nadhan_f nadhan_f is offline
Registered User
Join Date: Feb 2007
Location: Hyderabad, Andhra Pradesh, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi nidhigupta001,

I'm a learner. The below sample code might help you in connecting Access through VB.
N regarding displaying the first record, Its all how you want to retrieve the table in the .mdb and use accordingly as the database may hold any N number of tables.
Correct me if I'm wrong.
Public con As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub ConTest_Click()
    Dim con As New ADODB.Connection
    ' rs is the record set
    Dim rs As New ADODB.Recordset
    ' the (source=) is the path of the database
    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ConnectionTest\EmpInfo.mdb;Persist Security Info=False"
End Sub

Aspire Inspire Achieve
Reply With Quote