FilterEdit on second row with same name field

C

Conrad Santiago

I have a filter that looks like this:

Finish is less than or equal to Mon 3/15/04
And Start is greater than or equal to Sat 3/6/04
OR
Remaining work is greater than 0
And Start is less than or equal to Sat 3/6/04

I created a macro to modify this filter with the current date. This is what I have so far, however, how do you use the FilterEdit method to access the second row with the "Start" field?
============================
Sub PD_1WK_View()

edfilter_start = FilterEdit("Macro PD 1 WK View", True, False, True, , , "Start", , "is less than or equal to", ActiveProject.CurrentDate + 6)

edfilter_finish = FilterEdit("Macro PD 1 WK View", True, False, True, , , "Finish", , "is greater than or equal to", ActiveProject.CurrentDate)

edfilter_start2 = FilterEdit("Macro PD 1 WK View", True, False, True, , , "Start", , "is less than or equal to", ActiveProject.CurrentDate)

view_on = ViewApply("Macro PD 1 WK View")

End Sub
============================

Any response is appreciated.
--Conrad Santiago
 
J

JackD

Conrad.
The easiest way to do this is to go to tools menu / macros / macro recorder.
Turn it on. Create the filter. Turn it off. Copy the code.
What you are missing in your code is a value for the operator.
Here is an example
The pseudo code is this:
If (Line1 and line2) or (line3 and line4)

The real code is this:

FilterEdit Name:="Filter 1", TaskFilter:=True, Create:=True,
OverwriteExisting:=True, FieldName:="Start", Test:="is less than",
Value:="1/1/04", ShowInMenu:=False, ShowSummaryTasks:=False
FilterEdit Name:="Filter 1", TaskFilter:=True, FieldName:="",
NewFieldName:="Finish", Test:="is greater than", Value:="1/1/04",
Operation:="And", ShowSummaryTasks:=False
FilterEdit Name:="Filter 1", TaskFilter:=True, Parenthesis:=True,
FieldName:="", NewFieldName:="Start", Test:="is less than", Value:="2/2/04",
Operation:="Or", ShowSummaryTasks:=False
FilterEdit Name:="Filter 1", TaskFilter:=True, FieldName:="",
NewFieldName:="Finish", Test:="is greater than", Value:="2/2/04",
Operation:="And", ShowSummaryTasks:=False
FilterApply Name:="Filter 1"


-Jack
Conrad Santiago said:
I have a filter that looks like this:

Finish is less than or equal to Mon 3/15/04
And Start is greater than or equal to Sat 3/6/04
OR
Remaining work is greater than 0
And Start is less than or equal to Sat 3/6/04

I created a macro to modify this filter with the current date. This is
what I have so far, however, how do you use the FilterEdit method to access
the second row with the "Start" field?
============================
Sub PD_1WK_View()

edfilter_start = FilterEdit("Macro PD 1 WK View", True, False, True, , ,
"Start", , "is less than or equal to", ActiveProject.CurrentDate + 6)
edfilter_finish = FilterEdit("Macro PD 1 WK View", True, False, True, , ,
"Finish", , "is greater than or equal to", ActiveProject.CurrentDate)
edfilter_start2 = FilterEdit("Macro PD 1 WK View", True, False, True, , ,
"Start", , "is less than or equal to", ActiveProject.CurrentDate)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top