try the following code :-
take two labels(label1 and label2) and a textbox(Text1)
here the database ->"aa.mdb"
table ->"aa"
fields ->"id" (long,autonumber) ; "name" (text)
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String
str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\aa.mdb;Persist Security Info=False"
conn.ConnectionString = str
conn.Open
str = "select * from aa where id = " & Val(Text1.Text)
rs.Open str, conn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
Label1.Caption = rs!id
Label2.Caption = rs!Name
Else
MsgBox "No record found."
End If
Text1.Text = ""
Text1.SetFocus