spartansFC
Programmer
thread702-1705763
Hi
the above thread was closed and I think Duane mentioned that there would be a problem when some dates that have 1 or 2 characters at the start.
On the attached image i'm having problems showing the correct values as some dates have 1 character and some have 2 at the very beginning of the string, the problem only happens on the 2nd week of each month, I've worked out the other days using:
It also only happens when the string count is 12 in the 2nd week, the count of children on each day (in blue) is calculated using:
on the 8 April, based off the above, the values are:
8 chr13 Chr 10 (3)
25 chr13 chr 10 (4)
X chr13 chr 10 (3)
-1 (2) the minus 1 is because this day is a school holiday
this shows the number of children "25" correctly using Val(Mid([11],4,2)
but for the 10 June, the values in the field are:
10 chr 13 chr10 (4)
27 chr 13 chr10 (4)
X chr 13 chr10 (3)
0 (1)
this shows the number of children "7" incorrectly, the Val that I should be using Val(Mid([11],5,2)
I'm not sure how I change the code so that if the string count = 12 but the date is only 1 character to use: Val(Mid([11],4,2) or when
the string count = 12 and the date has 2 characters to use Val(Mid([11],5,2)
I thought about using the LEFT and LEN together so the new statement would have 5 conditions but i'm not sure if you can combine them in that way:
IIf(Len([11])=11,Val(Mid([11],4,2))
IIF(LEFT([11)=1 and LEN([11)=12,Val(Mid([11],4,2))
IIF(LEFT([11)=2 and LEN([11)=12,Val(Mid([11],5,2))
IIf(Len([11])=13,Val(Mid([11],5,2))
Val(Mid([11],3,2)
Thanks
Mikie
Hi
the above thread was closed and I think Duane mentioned that there would be a problem when some dates that have 1 or 2 characters at the start.
On the attached image i'm having problems showing the correct values as some dates have 1 character and some have 2 at the very beginning of the string, the problem only happens on the 2nd week of each month, I've worked out the other days using:
Code:
=IIf(Len([11])=11,Val(Mid([11],4,2)),IIf(Len([11])=12,Val(Mid([11],4,2)),IIf(Len([11])=13,Val(Mid([11],5,2)),Val(Mid([11],3,2)))))
It also only happens when the string count is 12 in the 2nd week, the count of children on each day (in blue) is calculated using:
Code:
Val: Max(Day([TheDate])) & Chr(13) & Chr(10) & Abs(Sum([strSessionDayCount]="X")) & Chr(13) & Chr(10) & Max([strSessionGrp]) & Chr(13) & Chr(10) & Min([IsHoliday])
on the 8 April, based off the above, the values are:
8 chr13 Chr 10 (3)
25 chr13 chr 10 (4)
X chr13 chr 10 (3)
-1 (2) the minus 1 is because this day is a school holiday
this shows the number of children "25" correctly using Val(Mid([11],4,2)
but for the 10 June, the values in the field are:
10 chr 13 chr10 (4)
27 chr 13 chr10 (4)
X chr 13 chr10 (3)
0 (1)
this shows the number of children "7" incorrectly, the Val that I should be using Val(Mid([11],5,2)
I'm not sure how I change the code so that if the string count = 12 but the date is only 1 character to use: Val(Mid([11],4,2) or when
the string count = 12 and the date has 2 characters to use Val(Mid([11],5,2)
I thought about using the LEFT and LEN together so the new statement would have 5 conditions but i'm not sure if you can combine them in that way:
IIf(Len([11])=11,Val(Mid([11],4,2))
IIF(LEFT([11)=1 and LEN([11)=12,Val(Mid([11],4,2))
IIF(LEFT([11)=2 and LEN([11)=12,Val(Mid([11],5,2))
IIf(Len([11])=13,Val(Mid([11],5,2))
Val(Mid([11],3,2)
Thanks
Mikie