drop down list in VB6 from Access table

Reply

Join Date: Oct 2004
Posts: 2
Reputation: spartanNE is an unknown quantity at this point 
Solved Threads: 0
spartanNE spartanNE is offline Offline
Newbie Poster

drop down list in VB6 from Access table

 
0
  #1
Oct 2nd, 2004
Hello
This is my first posting...and the next will be my second ...lol
I need to show the entire contents of a field in an access table, so that you can choose one item. i can then input data for the other equations. this is for a project and the vb form is an invoice. I can create the links but scrolling the data box is the only way i can get the value in the drop down box to change

Help please
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 15
Reputation: clartsonly is an unknown quantity at this point 
Solved Threads: 0
clartsonly clartsonly is offline Offline
Newbie Poster

Re: drop down list in VB6 from Access table

 
0
  #2
Oct 4th, 2004
If you are using bound controls, if I was you don't!! they work for millions of people but you do not have full control, and you learn nothing.

To add to a dropdown list.

Dim db As Database
Set db = opendatabase("c:\mydatabase\mydb.mdb")
Set mRs = db.openRecordset("select myField from myTable order by myField")
Do While Not mRs.EOF
Combo1.AddItem mRs("myField").Value
mRs.movenext
Loop
obviously do not open a database connection everytime.

PS don't forget to add the microsoft DAO object library first in the project references.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
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