Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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.

Reply With Quote
  #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.

Reply With Quote
  #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?


Reply With Quote
  #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

Reply With Quote
  #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

Reply With Quote
  #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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:34 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.