Hi
I have a problem retrieving the data from access database. I have a list of records for eg. Name,user_name, password etc.(all in access)
The problem is ,i want a solution wherein , when i double-click on a name, i want all the details for that particular name.
* i am using acess database as backend and Visual Basic 2005 as Front-end
example:

list of names are:

member1
member2
.
.
.
member n

Now, when i double click on member1, all the details for member1 shud be displayed.

Any help will be higly appreciated.

Recommended Answers

All 13 Replies

You did not stated here how you access your database, Are you using DAO or ADO? Here's a DAO code to display the data

Private Sub Member1_DoubleClick()
Dim db As Database
Dim rs As Recordset

Set db = OpenDatabase(App.Path & "\sample.mdb")
Set rs = db.OpenRecordset("select * from [USER TABLE] where username='" & txtUserName.Text & "'")
If Not rs.BOF Then
With rs
txtBirthday.Text = !Birthday
txtAddress.Text = !Address
... and so on
End With
End If
End Sub

As you are using Visual Basic 2005 as Front-end ,you should have posted the question in VB.NET forum .

Oh..okay... But i m not using VB.net ..so i thought i will post it in Visual Basic 4/5/6...
itz a forum for troubleshooting problems related to VB 2004/2005and 2006 ...rite Mr. Debasisdas????
and anyways , if u r interested in giving me suggestions related to my problem i wud highly appreciate it but if u just tell me that i have posted it in the wrong forum...u r wasting my time as well as ur time.

VB 2004 and 2006 .........

my god what is that.

some one please tell this boy this forum is for VB 4.0 / 5.0 / 6.0 not for 2004,2005 2006

well thank you Debasis...m a NOVICE in this field
appreciate ur HELP !

enough you two! it won't help if you're arguing on posting, ok dreamer boy I think this issue is already solved. ahm next time please post your problem in one time only don't try to repost it by rephrasing your sentence, please stick to one only, please don't be offended I mean nothing.

regards:

hi jireh...
i also got the same problem...
i'm using ADODB and my access file is in a server.... how can i access the data from that....

You did not stated here how you access your database, Are you using DAO or ADO? Here's a DAO code to display the data

Private Sub Member1_DoubleClick()
Dim db As Database
Dim rs As Recordset

Set db = OpenDatabase(App.Path & "\sample.mdb")
Set rs = db.OpenRecordset("select * from [USER TABLE] where username='" & txtUserName.Text & "'")
If Not rs.BOF Then
With rs
txtBirthday.Text = !Birthday
txtAddress.Text = !Address
... and so on
End With
End If
End Sub

i tried the code but itz showing type mismatch at thr line
Set rs = db.OpenRecordset("select * from team_details")
plz let me know the problem

i tried the code but itz showing type mismatch at thr line
Set rs = db.OpenRecordset("select * from team_details")
plz let me know the problem

please check the table team_details maybe it is mispelled...

or try to put a bracket in the table team_details..

Set rs = db.OpenRecordset("select * from [team_details]")

still itz showing the same error "type mismatch"

still itz showing the same error "type mismatch"

OK try to use a control, in General Tab select and click the Data then replace the rs into Data1.Recordset (Data1 is the default name of the Data once you put a first Data in the form)

So the code looks like this..

Set Data1.Recordset = db.OpenRecordset("Select * from [team_details]")

hey i'm done ya...

hey i'm done ya...

Does it work? So does this thread is solved?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.