I have an Access database that tracks resident population counts on a daily basis. I have a query problem with the DateAdd function where it won't count Saturday. It counts the population every day of the week fine except Saturday. Saturday is blank.
There is a Entry Date and an Exit Date and I use an expression to fix an Effective Begin Date and an Effective End Date that fixes the reporting period beginning and end dates. Some of the Entry dates are prior to, equal to, or after the start of the report period (Sunday).
Some of the Exit dates are before or equal to the report period end date, or null (Which means they are still in residence. The reporting time frame is Sunday through Saturday. There are three categories, 1,2,3, and two gender types, M, and F.
I use the DateAdd function to increment the days, e.g. DateAdd("d",0,([Enter Start Date])) This should equal Sunday. DateAdd("d",1,([Enter Start Date])) should equal Monday, etc.
If the criteria for category and gender are met a 1 or if not a 0 is placed in the row under the appropriate day. The columns are summed in a report giving the daily population count for each day of the week by category and gender. This all works fine until DateAdd("d",6,([Enter Start Date])) which should equal Saturday. I get no value returned for Saturday.
Here are the expressions to count Friday and Saturday:
FriMale: IIf([tbl-Client Information]![Gender]="Male",IIf([EFF_BGN]<=(DateAdd("d",5,[Enter Start Date])) And [EFF_END]>=(DateAdd("d",5,[Enter Start Date])),IIf([tbl-Client Information]![CourtType]="1" Or [tbl-Client Information]![CourtType]="2",1,0)))
SatMale: IIf([tbl-Client Information]![Gender]="Male",IIf([EFF_BGN]<=(DateAdd("d",6,[Enter Start Date])) And [EFF_END]>=(DateAdd("d",6,[Enter Start Date])),IIf([tbl-Client Information]![CourtType]="1" Or [tbl-Client Information]![CourtType]="2",1,0)))
Can anyone help on this.
Thanks,
Ken
There is a Entry Date and an Exit Date and I use an expression to fix an Effective Begin Date and an Effective End Date that fixes the reporting period beginning and end dates. Some of the Entry dates are prior to, equal to, or after the start of the report period (Sunday).
Some of the Exit dates are before or equal to the report period end date, or null (Which means they are still in residence. The reporting time frame is Sunday through Saturday. There are three categories, 1,2,3, and two gender types, M, and F.
I use the DateAdd function to increment the days, e.g. DateAdd("d",0,([Enter Start Date])) This should equal Sunday. DateAdd("d",1,([Enter Start Date])) should equal Monday, etc.
If the criteria for category and gender are met a 1 or if not a 0 is placed in the row under the appropriate day. The columns are summed in a report giving the daily population count for each day of the week by category and gender. This all works fine until DateAdd("d",6,([Enter Start Date])) which should equal Saturday. I get no value returned for Saturday.
Here are the expressions to count Friday and Saturday:
FriMale: IIf([tbl-Client Information]![Gender]="Male",IIf([EFF_BGN]<=(DateAdd("d",5,[Enter Start Date])) And [EFF_END]>=(DateAdd("d",5,[Enter Start Date])),IIf([tbl-Client Information]![CourtType]="1" Or [tbl-Client Information]![CourtType]="2",1,0)))
SatMale: IIf([tbl-Client Information]![Gender]="Male",IIf([EFF_BGN]<=(DateAdd("d",6,[Enter Start Date])) And [EFF_END]>=(DateAdd("d",6,[Enter Start Date])),IIf([tbl-Client Information]![CourtType]="1" Or [tbl-Client Information]![CourtType]="2",1,0)))
Can anyone help on this.
Thanks,
Ken