Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2003, 10:30 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo Boxes

Hi

I usually use a Sheridan Data Combo Box that has a datafieldlist property where you enter the field that will populate the combo box. I no longer have the facility to use Sheridan Data Combo, so I am using a normal combo box, but it does not have this property, can you please tell me where this is as it is populating the combo box with only the first record of the dataset. I have also tried a while loop with add items to the combo box, but this is also not working either.

Thanks in advance

Louisa

 
Old September 9th, 2003, 01:22 PM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Franklin66
Default

Hi Louisa...!
Try making a recordset with the data that you need from database... then do a Until EOF ... loop to feel the combo box using the additem method
Do Until rsRecordset.EOF
cboBox.AddItem rsRecordset!fildname
rsRecordset.MoveNext
Loop



 
Old September 10th, 2003, 09:26 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Louisa,

I don't think a regular combo box has this property. I have populated combo box before with something like this.

Dim adoCon as ADODB.Connection
Dim adoRst as ADODB.Recordset
Dim strConnect

'Open a DB connection
set adoCon = New ADODB.Connection
strConnect "sample connection string"
adoCon.open

'Open a recordset
set adoRst = New ADODB.Recordset
adoRst.open "My SQL Query Or Table",adoCon

'check to make sure the recordset has information
If not adoRst.eof and not adoRst.bof then
   'loop through the recordset
   Do until adoRst.eof
      'add the item
      combo1.addItem adoRst.fields.item("myField").value
      'move top the next item
      adoRst.MoveNext
   Loop
End If

Set adorst = nothing
Set adoCon = Nothing





Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Boxes nbuckwheat Access 1 January 15th, 2006 09:26 AM
3 combo boxes ttkt Beginning PHP 0 July 2nd, 2005 02:20 PM
Combo boxes socoolbrewster Access 1 March 4th, 2004 09:28 AM
Combo Boxes tjs206 VB Databases Basics 2 December 10th, 2003 05:20 PM
combo boxes damnnono_86 Access 2 October 15th, 2003 09:00 PM





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