DataField as Query criteria

omontesg

Registered User.
Local time
Today, 13:26
Joined
Feb 8, 2008
Messages
10
Hello every body;

I have a 3 tables:
1-CountriesDBF(Field: CountryName)
2-CitiesDBF(Fields: CountryName(with search Property = Countries.CountryName), CityName) Linked by CountryName with Countries
3-CitizensDBF(Fields: CountryName, CityName, CitizenName)

I want the following:as soon as the user selects the value for CitizensDBF.CountryName I want this field Value becomes the criteria for a Query to CitiesDBF so only the cities corresponding to the selected country appear in the query.

I Suppose this is possible but I still don't know how

Thanks for any help some body can give me.
 
Search here on "cascading" combos, as that's the concept you're after.
 
Search here on "cascading" combos, as that's the concept you're after.

Hi Paul,

Thanks for your help.
Searching for "Cascading combos" I found you have answered very similar
questions to many people... So something is missing on MS Access
documentation (or at least is not so evident).

Thanks for your patience.

Surely it works on Forms, but let me insist on Query's "criteria field", and also in "Raw-mode" editing tables.
For example: I put this statement in the RowSource of

CitizensDBF.CityName: SELECT CitiesDBF.CityName FROM CitiesDBF WHERE
(((CitiesDBF.CountryName)=CitizensDBF.CountryName)) ORDER BY
CitiesDBF.CityName;

Having that in mind...

I open the table CitizensDBF.
When I'm Creating (in raw-mode) a NEW record:
1.I Fed the Field CitizensDBF.CountryName.
2.Clicking CitizensDBF.CityName Pops up a window asking For the "parameter" CitizensDBF.CountryName. (data already given in step 1.)
3.TYPING it in the pop up window, the combo with the right cities is built ok.

When I'm Creating the next NEW record,
4-I Fed the Field CitizensDBF.CountryName with a different name.
5-Clicking the field CitizensDBF.CityName shows the combo "remembering"
the cities corresponding to the previous record Country name even though
I have assigned a different CitizensDBF.CountryName for this record.

is it not possible to have the "Cascade" easiness at these levels? (Query and raw data edition)

Thanks very much for your help and for sharing your time and knowledge.
 
To my knowledge it can not be done directly in a query or table. Most of us don't let users work directly with either one anyway. Users interact with forms and reports.
 

Users who are viewing this thread

Back
Top Bottom