Rabu, 06 Januari 2016

Re: [MS_AccessPros] Re: Dependent combo boxes

 

Bob-


Yes, that looks correct.

You need to use that as the Row Source in a combo box - perhaps called cmbCarName - on your form called frmCars.  You need to set up the cmbCarNumber combo box (drop-down box) so that its Bound Column is the Car Number and it displays something the user understands.  In the AfterUpdate event of the cmbCarNumber control, you need to Requery the cmbCarName control to get it to update to show the filtered list.  The parameter in your SQL is already set up to automatically get the value from the cmbCarNumber control on form frmCars.  You won't get prompted for a value if you set it up correctly.

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 Jan 6, 2016, at 10:47 PM, bburke@swiftaz.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John, here is a paste of the SQL statement; I think the spaces are correct here:

SELECT tblCars.CarName, tblCars.CarNumber
FROM tblCars
WHERE (((tblCars.CarName)=[Forms]![frmCars]![cmbCarNumber].[Value]))
ORDER BY tblCars.CarName;


The parameter dialog box work correctly, that is, when I enter, for example, "BN" it returns all the car numbers for "BN".  What I need to do is to be able to select a Car Name from a drop-down box, then have the car numbers show in another drop-down box.  These car name and numbers will be put into a report that the train operators can use to pick up and set out cars.  There may be 6 or 30+ cars.  The report also includes car type and length.  It will also include a town, supplier, and contents.  My question is, how do I go from the parameter dialog box to a drop-down box?

Thanks,

Bob


__._,_.___

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 (17)

.

__,_._,___

Tidak ada komentar:

Poskan Komentar