View Single Post
  #5  
Old October 1st, 2009, 04:08 PM posted to microsoft.public.access
Nurse Nancy
external usenet poster
 
Posts: 67
Default How can I create a form with a cascaded lookup?

This worked beautifully for me with regular combo box,, but now i have added
multivalue select combo boxes to my forms that I need to synch up . They were
created via access 2007 using the mult select lookup feature in the
underlying tables.


I am trying to sycnh a Market Combo Box to a Market Region Combo Box.

both have multiselection checkboxes when i select the dropdowns in the Combo
Box.


The SQL below does not work, i get nothing in the Market Combo
Box regardless of what i select in the Market Region CB

SELECT [MARKETS TABLE].[Market ID], [MARKETS TABLE].Market, [MARKETS
TABLE].[State ID], [MARKET REGION TABLE].[Market Region], [MARKET REGION
TABLE].[Market Region ID]
FROM [MARKETS TABLE] INNER JOIN [MARKET REGION TABLE] ON [MARKETS
TABLE].[Market Region ID] = [MARKET REGION TABLE].[Market Region ID]
WHERE ((([MARKET REGION TABLE].[Market Region ID])=[Forms]![Maintain
Products Form]![MarketRegionCB] ORDER BY [MARKETS TABLE].Market;


What I see in the Market Region CB when i make selections are
Northern
Southern
Eastern
Central

But what is bound is the ID values 1
1
2
3
4

If I hard code the values,, then the combo box does get synched up,,, see
below sql

is there any way to synch the combo boxes using sql ?

SELECT [MARKETS TABLE].[Market ID], [MARKETS TABLE].Market, [MARKETS
TABLE].[State ID], [MARKET REGION TABLE].[Market Region], [MARKET REGION
TABLE].[Market Region ID]
FROM [MARKETS TABLE] INNER JOIN [MARKET REGION TABLE] ON [MARKETS
TABLE].[Market Region ID] = [MARKET REGION TABLE].[Market Region ID]
WHERE ((([MARKET REGION TABLE].[Market Region ID])=[Forms]![Maintain
Products Form]![MarketRegionCB] Or ([MARKET REGION TABLE].[Market Region
ID])=2 Or ([MARKET REGION TABLE].[Market Region ID])=3 Or ([MARKET REGION
TABLE].[Market Region ID])=4 Or ([MARKET REGION TABLE].[Market Region ID])=5
Or ([MARKET REGION TABLE].[Market Region ID])=6 Or ([MARKET REGION
TABLE].[Market Region ID])=7))
ORDER BY [MARKETS TABLE].Market;





--
Nancy


"Ofer" wrote:

There is another way

In the RowSource Property of the Model combo create the SQL that includes
the filter build in, in the sql

Select ModalField From ModalTable Where Make =
Forms![FormName]![MakeComboName]

On the after update event of the Make combo, write the code
Me.[ModalComboName].requery


"Ben04Ram" wrote:

i.e. In a database of cars, I want to create a form where the user selects a
"Make" of car from a drop-down box and then selects a "Model" from a
drop-down which *only contains the valid Models* for the currently selected
Make. There doesn't seem to be a good way of doing this except by using VB
and dynamically altering the filter of the "Model" drop-down whenever the
"Make" is changed.