Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subjective lists
Message
From
13/05/2002 02:05:01
 
 
To
12/05/2002 16:49:03
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00655524
Message ID:
00655568
Views:
18
Hello,

It's more a database design issue than a form design.

I understand you are beginner, so I'll try to explain using common terms:

First of all, you need two tables: one containing regions, and the other containing coutries in every region.

Table's structure should be like follows:

Regions: id - integer, region - character (wide enough)
Countries: id - integer, region_id - integer, Country - character, wide enough

Usually, we use a stored procedure in database, to autoincrement the id field in both tables, but I think you do now update your tables on the fly, so you can write the id value in every row.

Next: records in both tables have to be related, somehow, isn't it? that relation is established by region_id field in second table.

To be more specific, every coutry in north america should have in region_id field the id taken from the first table. Something like that:
Regions                Countries
1 North America        1  1 Canada
2 Europe               2  1 USA
3 Asia                 3  2 France
                       4  2 Belgium
Now: for every region, we have at least one country having the same number in region_id field as the corresponding id for the corresponding region.

That's all about the tables, for the moment.

The lists should be configured like follows:

the region list:
RowSourceType = 6 (fields)
RowSource = 'regions.region,id'
BoundTo = .T.
BoundColumn = 2
Value = 0
The countries list
RowSourceType = 3 - SQL Statement
RowSource = 'Select country from countries where region_id = thisform.RegionList.Value into cursor crCountries order by country'
In InteractiveChange event of the Region list, you should place the following code:
thisform.countrylist.Requery()
And your lists should be fine.

If you need more help, feel free to drop a message. And there is no need for forgiveness. Welcome to UniversalThread. :)

Hope this helps

>Please forgive me. I don't know many of the appropriate computer terms, I really need some help with a database I'm designing for school.
>
>I'm trying make a certain list(free table) appear when the user makes a certain selection.
> i.e., when the user chooses "North America" in the first list, the next list will only display the countries in North America.
>
>How do I do this?
Grigore Dolghin
Class Software.
Previous
Reply
Map
View

Click here to load this message in the networking platform