Problem with retrieving data from access 2003

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2007
Posts: 19
Reputation: dreamerboy is an unknown quantity at this point 
Solved Threads: 0
dreamerboy's Avatar
dreamerboy dreamerboy is offline Offline
Newbie Poster

Problem with retrieving data from access 2003

 
0
  #1
Jul 16th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 43
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: Problem with retrieving data from access 2003

 
0
  #2
Jul 16th, 2007
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
Last edited by jireh; Jul 16th, 2007 at 7:56 pm. Reason: aaa
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,122
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 129
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Problem with retrieving data from access 2003

 
0
  #3
Jul 17th, 2007
As you are using Visual Basic 2005 as Front-end ,you should have posted the question in VB.NET forum .
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 19
Reputation: dreamerboy is an unknown quantity at this point 
Solved Threads: 0
dreamerboy's Avatar
dreamerboy dreamerboy is offline Offline
Newbie Poster

Re: Problem with retrieving data from access 2003

 
0
  #4
Jul 17th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,122
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 129
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Problem with retrieving data from access 2003

 
0
  #5
Jul 17th, 2007
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
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 19
Reputation: dreamerboy is an unknown quantity at this point 
Solved Threads: 0
dreamerboy's Avatar
dreamerboy dreamerboy is offline Offline
Newbie Poster

Re: Problem with retrieving data from access 2003

 
0
  #6
Jul 17th, 2007
well thank you Debasis...m a NOVICE in this field
appreciate ur HELP !
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 43
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: Problem with retrieving data from access 2003

 
0
  #7
Jul 17th, 2007
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:
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 42
Reputation: guru511 is an unknown quantity at this point 
Solved Threads: 3
guru511's Avatar
guru511 guru511 is offline Offline
Light Poster

Re: Problem with retrieving data from access 2003

 
0
  #8
Jul 18th, 2007
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....


Originally Posted by jireh View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 42
Reputation: guru511 is an unknown quantity at this point 
Solved Threads: 3
guru511's Avatar
guru511 guru511 is offline Offline
Light Poster

Re: Problem with retrieving data from access 2003

 
0
  #9
Jul 18th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 43
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: Problem with retrieving data from access 2003

 
0
  #10
Jul 18th, 2007
Originally Posted by guru511 View Post
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..
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Set rs = db.OpenRecordset("select * from [team_details]")
Last edited by jireh; Jul 18th, 2007 at 2:37 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC