Quote:
Originally Posted by NeoPa
Alternatively, if you post the criteria you used I can check it over and make recommendations.
Here is the code based on the PEB recommendation. It is a function because it is called from the switchboard. When it runs, all the variables are correct, but no data results where some should.
Public Function Occupancy()
Dim EnterDate As Date
Dim MyWeek As Integer
Dim MyYear As Integer
Dim MyCriteria As String
EnterDate = InputBox("Please enter a date.")
MyWeek = DatePart("ww", EnterDate)
MyYear = DatePart("yyyy", EnterDate)
MyCriteria = "([ArrWk] = ' " & MyWeek & " ' OR [DepartWk] = ' " & MyWeek & " ' " & _
"OR ([ArrWk]<' " & MyWeek & " ' and [DepartWk] > ' " & MyWeek & " ')) " & _
"AND ([ArrYear] = ' " & MyYear & " ')"
Dim MyRpt As String
MyRpt = "rptCabinOccupancy"
DoCmd.OpenReport MyRpt, acViewPreview, "qryWeekSum_01", MyCriteria
End Function
Thank you for your assitance