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

Project 2003 - Date Filters

Status
Not open for further replies.

Tamrak

MIS
Jan 18, 2001
213
US
Good morning,

I have questions regarding the filters in Microsoft Project 2003 Server.

When I went to Project, Filtered for: for example ALL TASKS, and dragged down for more filters, I selected one item, such as Date Range.

I edited and there was another window popping up with a Start and Finish, that needed to be pulled from the field names.

They asked for the value.

My question is very simple. How can I default the value into the format such as -> Date()-30 - for my start date and Date()+90 for my finish date? (It means - today minus 30 for my start date and today plus 90 for my finish date.)

I tried writing the formula and it did not accept. I tried every way I knew, such as putting with equal sign =, like we use in Excel.

I do appreciate your time. I hope this will not be difficult. I just look for how to use the automation in these two fields, without having to be prompted for the date parameters.

Thank you for your time.
 
Filters are static. This means that, once they are created, the parameter information used in the filter does not change. Therefore, you have to dynamically create a filter. And that means you have to write a macro which creates the filter.

You then have two choices: manually invoke the macro (Tools | Macros... and then select the macro that creates the filter) or find some way to invoke the macro during start up. I have chosen the second approach.

It's not elegant but I've used it in the past and it works. Watch for code wrapping!!!

Once you have loaded the Project, click on Project | Filtered for... | More filters... select the filter (I called it PDQBach) and click on Edit. In the filter you'll see the static dates which were created dynamically by the macro.

(Note: I've never tried this within a Project Server environment so I don't know how persistent the macro is. Please explore and report back.)

1. In the Project_Activate sub:

Private Sub Project_Activate(ByVal pj As MSProject.Project)
Dim strPrj As String
Static binBeenHereDoneThat As Boolean
If binBeenHereDoneThat Then
Else
strPrj = ActiveProject.Name
On Error Resume Next
PDQBach
binBeenHereDoneThat = True
End If
End Sub

2. In a module in the project

Sub PDQBach()
' Start is within the past 30 days
FilterEdit Name:="PDQBach", TaskFilter:=True, _
Create:=True, OverwriteExisting:=True, _
FieldName:="Start", test:="is greater than", _
Value:=(Now() - 30), _
ShowInMenu:=True, ShowSummaryTasks:=True

' Start is within the next 90 days
FilterEdit Name:="PDQBach", TaskFilter:=True, _
FieldName:="", _
NewFieldName:="Start", test:="is less than", _
Value:=(Now() + 90 ), _
Operation:="And", _
ShowSummaryTasks:=True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top