
Originally Posted by
June7
1. CF Backcolor highlight for current week will conflict with milestone highlight. CF works on only textbox and combobox and cannot set border. Could probably use VBA to set textbox border width and color and/or label backcolor. Code would be in Detail Format event. This event executes only for PrintPreview or direct to printer, not ReportView. Or change the week number labels to textboxes and use CF.
Field Value equal to: Format(Date(), "ww")
2. Change the SQL built in VBA to JOIN tables so ProjectStatus field is available and apply criteria.
sSQLp = sSQLp & "FROM tblSchedulePlan INNER JOIN tblProjects ON tblProjects.ProjectID = tblSchedulePlan.ProjectID WHERE ProjStatus=1"
3. So now the legend appears only on the last page? As a reader, I would find that annoying. Given choice, would prefer on first page.
Code:
TRANSFORM Max(tblScheduleMilestonesReportSetup.SchedPlanPHaseID) AS MaxOfSchedFaseInitIDSELECT tblProjects.ProjectID, IIf([SchedPlanPhaseID]<10,[tblProjects].[ProjName],[tblProjects].[ProjName]) AS ProjName
FROM tblScheduleMilestonesReportSetup LEFT JOIN tblProjects ON tblScheduleMilestonesReportSetup.ProjectID = tblProjects.[ProjectID]
GROUP BY tblProjects.ProjectID, IIf([SchedPlanPhaseID]<10,[tblProjects].[ProjName],[tblProjects].[ProjName])
ORDER BY tblProjects.ProjectID DESC , IIf([SchedPlanPhaseID]<10,[tblProjects].[ProjName],[tblProjects].[ProjName])
PIVOT tblScheduleMilestonesReportSetup.SchedWeek;
So in this code for query I want to insert a condition where it only looks at Active or Future projects which are 1 & 4. I assume I would just do it in the query code, but I wasn't sure where.
I see what you put above and I was curious which line I was replacing here:
Code:
sSQLp = "INSERT INTO tblScheduleMilestonesReportSetup (ProjectID, SchedPlanPhaseID, SchedWeek, SchedWeekSeq) " sSQLp = sSQLp & "SELECT "
sSQLp = sSQLp & "[ProjectID], "
'Select SchedPlanPhaseID if SchedPlanPhaseID is "active" in dCurrDate Week (Monday - Sunday)
sSQLp = sSQLp & "Iif(#" & dCurrDate & "# between [startdate]-Weekday([startdate],2) +1 and [enddate]-Weekday([enddate],2) +7, [SchedPlanPhaseID],null) as Expr2, "
'Select SchedWeek (subtract one year if Week is Week 52 ???)
sSQLp = sSQLp & "'" & IIf(Right("0" & DatePart("ww", dCurrDate, vbMonday, vbFirstFourDays), 2) = 52, -1, 0) + DatePart("yyyy", dCurrDate, vbMonday, vbFirstFourDays) & Right("0" & DatePart("ww", dCurrDate, vbMonday, vbFirstFourDays), 2) & "' AS SchedWeek ,"
'Select Week sequence
sSQLp = sSQLp & iWeek & " "
sSQLp = sSQLp & "FROM tblSchedulePlan "
'Group the records by Project and - if SchedPlanPhaseID is active in dCurrDate Week - by SchedPlanPhaseID
'sSQLp = sSQLp & "GROUP BY projectid, Iif(#" & dCurrDate & "# between [startdate] and [enddate], [SchedPlanPhaseID],null)"
For some reason I have one project that does not have any phases in the date selection I put in, but it is still showing on the report.