General information
Category:
Forms & Form designer
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only