Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

filter a combo box vfp

Posted on 2010-11-26
3
Medium Priority
?
2,604 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 43

Accepted Solution

by:
pcelba earned 375 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

971 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