Solved

filter a combo box vfp

Posted on 2010-11-26
3
2,286 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
I had in fact kind of got there myself (a first for me!) but thanks anyway!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now