Rabu, 23 Desember 2015

Re: [MS_AccessPros] Dependent combo boxes

 

Bob-


The simplest way is to use parameter queries that use a special parameter to point to the previous combo box to obtain a filter.  So, the Row Assuming your form is named frmCars, and the first combo box is called cmbCarName, ource for Car Number might look like:

SELECT CarNumber FROM MyTable WHERE CarName = [Forms]![frmCars]![cmbCarName]

In AfterUpdate of Car Name, do a Requery on the Car Number combo.  Do a similar cascade for the subsequent combo boxes, and do a Requery in After Update as appropriate.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On Dec 22, 2015, at 10:54 PM, bburke@swiftaz.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


I have a table with Car Name, Car Number, Car Type, and Car Length.  There are many car names but each car carries a unique car number.  For example, ATSF may have many cars, but each ATSF car will have a unique number.  Each Car Name and Car Number will have a specific Car Type and Car Length.  I would like to be able to pick a Car Name (i.e. ATSF or BN) and have the Car Number combo box display all the numbers for that Car Name.  When I pick a Car Number I would like to have the Car Type and Car Length combo boxes display the correct info for that particular car.  I know some coding is needed, but not sure how to go about it.  Any suggestions would be appreciated.  I am using MS Access 2010.

Thanks,

Bob Burke


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar