Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET FILTER TO Question

Status
Not open for further replies.

fkwong

Programmer
Jul 5, 2002
65
US
I set the filter for a table in a data entry form. Then, I have a need to break the filter by issuing "SET FILTER TO" command in one of the navigation button (class) to check other records in the same table. The problem I run into is the original SET FILTER condition is still exist even though the FILTER() show empty string.

Please advice what I did wrong. Thanks!
 
When changing a FILTER, it's always a good idea to move the current record pointer. GO TOP, LOCATE, or even SKIP will cause the current filter condition to be reevaluated.

Also if you are displaying the table records in a grid on this form, it's a good idea to do a Refresh() on the grid.

Rick
 
Hi fkwong,

1. After the SET FILTER condition.. add the code..
GO TOP
or
LOCATE|
or
nRec=RECNO()
GO nRec

The point is that the record pointer needs to be moved or an attempt need to be made.. so that the filter gets refreshed.

2. HOwever.. I suggest a different approach..
For the table with filter conditions..
Open the same table in the data environment again with out any filter and with a different alias name. Example..
Add the the same table again to Data environment as myTable1. Then use this table for the place where you need all the records. This way.. you dont have to set the filter again and again.. and also the record pointers need not be set again and again.

:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
If the filter is set in the dataenvironment, you could use:

ThisForm.DataEnvironment.CloseTables
ThisForm.DataEnvironment.OpenTables

as the last two lines of the click event for the command button.

This will reset the filter and refresh the form without moving the pointer.

If, however, you are setting the filter in the Load event, etc., this won't help.

Pat
 
culleoka,

ThisForm.DataEnvironment.CloseTables
ThisForm.DataEnvironment.OpenTables



That won't move the pointer??? If that's true then I just learned something too thanks. Slighthaze = NULL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top