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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FilterEdit Method not working

Status
Not open for further replies.

cdrivanova

Technical User
Oct 15, 2002
8
US
Newbie here -- please be patient! [ponytails]

I'm writing a filter in MS Project that filters down to a specific resource working on a task of 1) a duration greater than 0 days and 2) which has not yet been completed (i.e, % Complete is less than 100%). I'm using the FilterEdit method within a For-Next statement. My code is:

Code:
FilterEdit Name:="L10n_Filter", taskfilter:=True, create:=True, overwriteexisting:=True, FieldName:="% Complete", test:="is less than", Value:="100%"

FilterEdit Name:="L10n_Filter", taskfilter:=True,  FieldName:="Duration", test:="is greater than", Value:="0d"

FilterEdit Name:="L10n_Filter", taskfilter:=True, 
FieldName:="Resource Initials", test:="contains", Value:=CapArray(x)

If I add or do not add the operand after value (ex: Operation:="And"), I get Run-time Error 1004 ("an unexpected error occurred with the method"). If I run each query individually, it works, but I would like it all in one filter.

Any helpful hints? THANKS!
 
I figured it out.

For the 2nd, 3rd, etc. queries, the FieldName field should be "" and you add in NewFieldName with the new info. Otherwise, you continually overwrite the first field. So, the updated code should look like this:

Code:
FilterEdit Name:="L10n_Filter", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Resource Initials", test:="contains", Value:=CapArray(x), Operation:="And"

FilterEdit Name:="L10n_Filter", TaskFilter:=True, FieldName:="", NewFieldName:="% Complete", test:="is less than", Value:="100%"

FilterEdit Name:="L10n_Filter", TaskFilter:=True, 
FieldName:="", NewFieldName:="Duration", test:="is greater than", Value:="0d", Operation:="And"

Hope that helps someone else who might come across this problem.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top