Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 November 17th, 2004, 12:57 AM
Registered User
 
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populate Combo Box

I need to populate a combo box into 3 columns not just one as shown below
I will appreciate any assistance

While Not rs.EOF
cbo2.AddItem (rs.Fields(0) & " " & rs.Fields(1) & " " & rs.Fields(2))
If rs.EOF Then
GoTo Exitna
End If
rs.MoveNext
Wend

Many thanks
Phil

 
Old November 17th, 2004, 04:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can't you use a combo box bound to the original table/query from which rs is derived? Then you can use the Column Count property.

Clive Astley
 
Old November 18th, 2004, 01:59 AM
Registered User
 
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

clive, thanks , but I wantd to populate from a recordset run from a sql query . I have now got the answer, I had left out the semicolons between the rs.fields()

cbo2.AddItem (rs.Fields(0) & ";" & rs.Fields(1) & ";" & rs.Fields(2))

all the best
Phil.t
 
Old November 18th, 2004, 03:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Phil. Glad you got the answer. And I have learnt something too - I wouldn't have thought of the semicolons. So, thanks.

Best wishes,

Clive Astley





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 a combo box from database w/vbscript morituri VBScript 1 March 1st, 2005 07:06 PM
Populate combo box with access db with using ADO neo_jakey Pro VB Databases 1 October 23rd, 2004 10:11 AM
Populate combo box with access db with using ADO neo_jakey VB Databases Basics 3 October 13th, 2004 03:36 PM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM





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