SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 12th, 2003, 09:50 AM
AliCat AliCat is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Green Bay, Wisconsin
Posts: 60 AliCat User rank is Private First Class (20 - 50 Reputation Level)AliCat User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 43 m 32 sec
Reputation Power: 5
Accessing an Access DB with VB

I am setting up a VB form that connects to multiple tables in an Access DB. My connections are all good and work well but the problem is with my combo boxes.

If, for instance, I have a drop down called "Ice Cream Flavors" and the values are "Vanilla", "Chocolate", and "Strawberry", my combo box only shows "Vanilla" and doesn't show the other two in the drop-down. (Drop down is blank) Instead, I have to use the ADO arrows to make the data move. Is there anyway I can change it so that the information can be seen on a drop down instead of by clicking those darn arrows???


THANKS

Reply With Quote
  #2  
Old August 12th, 2003, 04:06 PM
utmostrusselb utmostrusselb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 40 utmostrusselb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Try something like this:
Option Explicit
Dim MyConnection as String

Form_load()
MyConnection = "C:Where ever database is /database.mdb"

Call FillCmbList

End sub

Private Sub FillCmbList
Dim db As Database
Dim ws As Workspace
Dim Rst As DAO.Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(MyConn)
Set Rst = db.OpenRecordset("SELECT * FROM (tablename) ORDER BY (main field)", dbOpenDynaset, dbReadOnly)

Do While Not Rst.EOF
CmbDr.AddItem Rst.Fields("Main Field")
Rst.MoveNext
Loop

End sub
__________________
Best regards,
Russ Bergen
Senior Software Developer and Webmaster

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Accessing an Access DB with VB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway