954,136 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with retrieving data from access 2003

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.

dreamerboy
Newbie Poster
19 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

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

debasisdas
Posting Genius
6,870 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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.

dreamerboy
Newbie Poster
19 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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

debasisdas
Posting Genius
6,870 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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

dreamerboy
Newbie Poster
19 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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:

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

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

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 

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

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 
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]")
jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

still itz showing the same error "type mismatch"

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 
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]")
jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

hey i'm done ya...

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 
hey i'm done ya...

Does it work? So does this thread is solved?

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You