Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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
  #1 (permalink)  
Old June 1st, 2007, 09:11 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Filling Combobox with value from other Combobox

Hi All

I am trying to populate combobox with Query
Row Source Type: Table/Query
Row Source: [SQL query]
this combo box is populating fine now what I am trying to do when any value select in this combobox1, Combobox2 takes selected value as parameter and populate itself.

Any idea suggestion welcome
Regards
Ayaz

  #2 (permalink)  
Old June 2nd, 2007, 03:58 PM
Friend of Wrox
 
Join Date: Apr 2006
Location: Ternat, , Belgium.
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Little question: If you do not select a value in the first one, will the user be able to select a value in the second one? Or will the second one be empty until a value is choosen in the first one.

What you probably have to do is to requery the second one on the after update event of the first one... If this is not helping you, lett me know.

  #3 (permalink)  
Old June 4th, 2007, 03:33 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Here's detail what i am trying to do
combobox2 is depended on combobox1 therefore if nothing selected in combobox1 mean no list will appear

here's flow

combobox1 [shows list of tables in database e.g Suppliers Table]
combobox2 [shows all Suppliers ID and Details which exist in Suppliers Table ]
Combobox3 [Shows distinct product designed by that selected Suppliers in combobox2 ]

Finally --> Export all records in excel sheet associated with that particular company product

Now reason why we doing this is we need to export price list for specific product make by suppliers

I hope i explain it reasonably and i am having a problem because I am coming from Java and C# background and VBA access is something bit different.

  #4 (permalink)  
Old June 4th, 2007, 04:24 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: Ternat, , Belgium.
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So what I think you should do is:

in the first combo box you list all tables (don't know if you know how to do this).

On the after update event of the first combo you put this code:

dim sTable as string
dim sSQL as string

sTable = me.combo1
sSQL = "SELECT * FROM sTable"
me.combo2.RowSource = sSQL
'don't think you need the next line
me.combo2.Requery

this should give you the values in the second combo.
For the thirth one, you do kind of the same, but you change it where needed...

Is this enough, or do you need more?


  #5 (permalink)  
Old June 4th, 2007, 11:00 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

can I populate list control in similar way

  #6 (permalink)  
Old June 5th, 2007, 04:11 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: Ternat, , Belgium.
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you want to populate a list box, you can do that the same way.

Is everything clear to you or not? If you still have some problems or questions, let me know

  #7 (permalink)  
Old June 5th, 2007, 04:58 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Thanks Vince



Similar Threads
Thread Thread Starter Forum Replies Last Post
filling the combobox using sql data adapter kumaran BOOK: Professional .NET 2.0 Generics 4 October 5th, 2015 07:57 AM
Filling ComboBox from Dataset dcathers C# 9 June 15th, 2013 03:31 AM
Filling a combobox/listbox unmeshraut VB How-To 1 September 21st, 2007 12:08 PM
Filling comboBox from an XML File kuznickic C# 2005 11 August 29th, 2007 01:54 AM
Filling SubForm from ComboBox ayazhoda Access VBA 4 June 5th, 2007 10:56 AM





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