Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 1st, 2004, 10:11 AM
Authorized User
Join Date: Jun 2003
Location: Mexico City, Distrito Federal, Mexico.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populate combo box with access db with using ADO

I am very new to making VB applications although I have a fair amount of experience with ASP. I want to populate a dropdown combo box with all the users in my database which is situated in the same directory as the application.

I am unsure of the coding but I would assume that you would have to locate the db like:

App.Path & "\despatcher97.mdb"

and the SQL statement would be as follows:

strSQL = "select * from Users order by Name"

and with my experience with ASP I assume the population part would be something like:

    Combo1.AddItem .Fields("Username").Value
    Combo1.ItemData(Combo1.NewIndex) = .Fields("Ident").Value
  Loop Until .EOF

I am just unsure how you would fit it all together.
Any help with this matter would be greatly received.

With many thanks for your time and assistance,

Reply With Quote
  #2 (permalink)  
Old October 23rd, 2004, 10:11 AM
Aal Aal is offline
Authorized User
Join Date: Oct 2004
Location: , , .
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts

Try this code :
--- first set your recordset vars ----------
I assume the Rec Var with --> RC
strSQL = "select * from Users order by Name"
rc.Open strsql,cn,2,1

if not rc.EOF then
      while not rc.EOF
            combo1.additem rc!username
   set rc = nothing
end if

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a text box from a combo box value dnf999 Access VBA 7 February 6th, 2012 02:24 PM
Populate Combo Box phil.t Access 3 November 18th, 2004 03:39 AM
Populate combo box with access db with using ADO neo_jakey VB Databases Basics 3 October 13th, 2004 03:36 PM
Populate combo box with access db with using ADO neo_jakey Beginning VB 6 1 September 28th, 2004 02:07 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM

All times are GMT -4. The time now is 02:40 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.