Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 May 10th, 2004, 07:50 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default Populate List Box by Combo Box Selection

Hi,

   I know this must have been covered a thousand times... I have three tables: tblMain, tblJurisdiction, tblBuilding. The tblMain has a look up to tblJurisdiction, and a look up to tblBuilding. tblBuilding also has a look up to tblJurisdiciton since we have several Jurisdictions, and within those Jurisdictions there are several Buildings each. Perhaps tblMain only needs to look up tblBuilding since the Jurisdiction issue will be covered through the tblBuilding look up to tblJurisdiction.

   I have a form that uses tblMain, and I would like users to be able to select a Jurisdiction in a combo box (no problem there) and then based on the Jurisdiction they selected, have a limited selection in a list box of Buildings in that Jurisdiction. They should be able to select more than one Building.

   Thanks in advance...

mmcdonal

mmcdonal
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old May 10th, 2004, 06:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have the RowSource for your Building based on the Jurisdiction Combobox, and requery it when Building is changed.
For example, on the AfterUpdate event of the Jurisdiction Combobox (named cJurisdiction here)
Code:
Me.cBuilding.RowSource = "SELECT * FROM tblBuilding WHERE JurisdictionID = " & Me.cJurisdiction
Me.cBuilding.Requery
There's more elegant ways to do it, but that's the best way I can describe it using code only, and at this time of the day

Steven

I am a loud man with a very large hat. This means I am in charge
 
Old June 15th, 2004, 12:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

This was a clear and direct answer to your question. If you don't understand it- that doesn't make it vauge.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee





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
Combo Box -1 Selection Little Shell VB.NET 2002/2003 Basics 5 June 14th, 2005 06:16 PM
Populate a combo box from database w/vbscript morituri VBScript 1 March 1st, 2005 07:06 PM
Populate Combo Box phil.t Access 3 November 18th, 2004 03:39 AM
Populate combo box with access db with using ADO neo_jakey Beginning VB 6 1 September 28th, 2004 02:07 AM





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