Funky,
Ok, put the below code into a module. Make sure your query name is replaces the one below in the Set qd = db.Querydefs.... statement, and make a report and replace that name in the below OpenReport statement. There is another short block of code that goes into the report
Sub CrtCross()
'alters PIVOT clause in existing query to reflect current date and and the previous 4 days (5 days)
Dim db As Database, qd As QueryDef, strSQL As String, strPVT As String
Dim iPos As Integer, dtStart As Date
Set db = CurrentDb
dtStart = Date 'for now, the date we look at for the 'last 5 dates' is today, but you could pass this in
'set an object for the query
Set qd = db.QueryDefs("qryTestCross"

'get base sql
strSQL = qd.sql
'Find the word 'PIVOT'
iPos = InStr(strSQL, "PIVOT"

'strip everything after pivot, but first make sure it was found
If iPos = 0 Then
MsgBox "Invalid Crosstab sql"
Exit Sub
End If
strSQL = Left$(strSQL, iPos - 1)
'now add the new pivot statment, reflect todays 'Last 5 dates' in the Pivot clause. Assume for this case the field is named "ord_date_d"
strPVT = " PIVOT ord_date_d IN(#" & dtStart - 4 & "#,#" & dtStart - 3 & "#,#" & dtStart - 2 & "#,#" & dtStart - 1 & "#,#" & dtStart & "#)"
'put the old statement together with the new PIVOT clause
strSQL = strSQL & strPVT
'Update the query itself
qd.sql = strSQL
'Open the report
DoCmd.OpenReport "rptTestCross", acViewPreview
End Sub
************* now the below goes into the report, in the OPEN event:
Private Sub Report_Open(Cancel As Integer)
'VERY IMPORTANT: You must name the 5 labels in the following manner:
'lblDateMinus0 , lblDateMinus1, lblDateMinus2, etc, etc
'AND NAME THE TEXTBOX's as follows:
'txtDateMinus0,txtDateMinus1,txtDateMinus2 etc.
'format labels
Dim i As Integer
For i = 0 To 4
'the labels I just used a different date format, you could use any
Me("lblDateMinus" & i).Caption = Format(Date - i, "MMM/DD/YYYY"

Next i
'set textbox controls
For i = 0 To 4
Me("txtDateMinus" & i).ControlSource = "=[#" & Date - i & "#]"
Next i
End Sub
In the first block of code, I used the variable dtDate, which is set to Date(), meaning today's date. An enhancement would be to change it to, say, a date on a form that you enter. IF that is done, then the code in the open event must fetch the date from that textbox.
--Jim