Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

filter a combo box vfp

Posted on 2010-11-26
3
Medium Priority
?
2,552 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Check out what's been happening in the Experts Exchange community.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 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