943,923 Members | Top Members by Rank

Ad:
Apr 17th, 2008
0

Add Data from Access to Combo Box

Expand Post »
please help that how to add data of one field of database to the combo box.

i attached one rar file with this. check that
Similar Threads
Reputation Points: 8
Solved Threads: 0
Light Poster
pranavdv is offline Offline
26 posts
since Mar 2007
Apr 17th, 2008
0

Re: Add Data from Access to Combo Box

Reputation Points: 20
Solved Threads: 1
Junior Poster in Training
lostandfound is offline Offline
51 posts
since Jan 2008
Apr 17th, 2008
0

Re: Add Data from Access to Combo Box

hi pranavdv...
where is your attachment?
Rar file is not supported in this forum, use zip file.
Last edited by november_pooh; Apr 17th, 2008 at 9:46 pm.
Reputation Points: 29
Solved Threads: 0
Junior Poster
november_pooh is offline Offline
120 posts
since Mar 2008
Apr 17th, 2008
0

Re: Add Data from Access to Combo Box

try this code :
vb Syntax (Toggle Plain Text)
  1. Private Sub Form_Load()
  2. Dim RS As ADODB.Recordset
  3. Dim Conn As ADODB.Connection
  4. Dim Comm As ADODB.Command
  5. Dim str As String
  6.  
  7. Set Conn = New ADODB.Connection
  8. Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:\Only Me\Authors.mdb"
  9. Conn.Open
  10. Set Comm = New ADODB.Command
  11. Set Comm.ActiveConnection = Conn
  12. Comm.CommandText = "SELECT Au_ID FROM Authors"
  13. Comm.CommandType = adCmdText
  14. Set RS = Comm.Execute
  15.  
  16. Do Until RS.EOF = True
  17. Combo1.AddItem RS!Au_ID
  18. RS.MoveNext
  19. Loop
  20.  
  21. Set RS = Nothing
  22. Set Comm = Nothing
  23. Set Conn = Nothing
  24. End Sub
Last edited by Jx_Man; Apr 17th, 2008 at 11:05 pm.
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,140 posts
since Nov 2007
Apr 18th, 2008
0

Re: Add Data from Access to Combo Box

Thanks JX_MAN, I will take that as a compliment. I wonder how many of those solved threads of yours are down to blatantly copying other members replies.
Whereas copying obviously works for some , others benefit from doing a little bit of thinking themselves!!
Hope the code helps with your problem Pranavdv.
Getting to grips with the ADO control is hard work but is a great tool once you get rolling.
Cheers for now
Reputation Points: 20
Solved Threads: 1
Junior Poster in Training
lostandfound is offline Offline
51 posts
since Jan 2008
Apr 18th, 2008
0

Re: Add Data from Access to Combo Box

??
hmm...sorry if this code some like yours...
well, i have a book for this.
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,140 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: VB6 and mysql problem in filtering dates
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: tutorial of VB





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC