Solved

filter a combo box vfp

Posted on 2010-11-26
3
2,366 Views
Last Modified: 2012-05-10
Hi:
It would be nice to see a history of stocks we have ordered.
So I have a form with a combo list of 150 stock items; and a grid of the order table.
Selecting a stock code from the combo reveals in the grid all the orders for that item.
But I would like to filter the combo. Every stock item is in a group ('type' in the stock table).
It would be nice to filter the combo so that just the items for the type required is displayed.
So I created a table (called "type") of the types. On the form I put a list box of the types, joined to the stock table. I hoped that selecting a type from the type list box would filter the combo to that type...but it does not. The filter stills calls up all 150 products.
Is it possible to filter the combo to the value selected in the list box?
Thanks!
0
Comment
Question by:ClaytonGlass
  • 2
3 Comments
 

Author Comment

by:ClaytonGlass
ID: 34216714
I have added this to the dropdown method of the combo box:
SET FILTER TO type = thisform.List1.Value
THISFORM.Refresh
but get an error:
"THISFORM can only be used in a method".
I thought it was!
0
 
LVL 41

Accepted Solution

by:
pcelba earned 125 total points
ID: 34217270
The FILTER expression is valid anywhere the table remains open it means even outside the form.

If the thisform.List1.Value is of a character data type then you may define the filter following way:

lcFilter = thisform.List1.Value
SET FILTER TO type = "&lcFilter"

The filter must be set in the Listbox - you may use e.g. Valid method.

Depending on the Combo RowSourceType you would probably have to call combo's Requery() method after the filter change.
0
 

Author Closing Comment

by:ClaytonGlass
ID: 34217481
Thanks!
I had in fact kind of got there myself (a first for me!) but thanks anyway!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
A professional opinion on which Apple product to buy, and a tidbit about the WWDC.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question