Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indexing one VFP Combo Box from Data selected in another
Message
From
30/09/1996 15:26:04
 
 
To
27/09/1996 21:03:36
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00007770
Message ID:
00008899
Views:
51
One way to use the first combobox to select a group of records to display in the second combobox is to use a parameterized view. Here is an example of a parameterized view you could create:

CREATE VIEW bird_family AS SELECT * FROM Avifauna ;
WHERE (UPPER(Avifauna.Family) = UPPER(?cFamily))

You must have the database open exclusive before executing this command. This is also assuming you have a field called FAMILY of type character in the table AVIFAUNA.DBF.

To experiment with parameterized views, try USEing this view and entering different values for "cFamily" when prompted. Browse the table to see what was selected. Note that for this example to execute quickly, you should have an index on UPPER(FAMILY).

To use this view on a form, simply add it to your DataEnvironment and set the property NoDataOnLoad to .T. (this prevents you from being prompted for the parameter "cFamily" each time the form is ran).

I would look at possibly using a list or grid object in place of the second combobox. Try placing a grid on your form with the RecordSource set to "bird_family".

In the InteractiveChange event of your existing combobox, place the following code:

LOCAL cFamily
cFamily = THIS.DisplayValue
= REQUERY("bird_family")
THISFORM.Grid1.Refresh() && Replace Grid1 with the name of your grid

This code will refresh the contents of "bird_family" based on what you select in the combobox. This is just a quick example to help get you started so if you run into any problems or have any questions, please post.

-Doug-
Previous
Reply
Map
View

Click here to load this message in the networking platform