yes/no button occurrency

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello
in my database got a table who keeps: person code, date, IN, Holiday,Absent,
OFF; where IN, holiday, absent and OFF are Yes/No buttons.
on the time i build it with yes/no buttons to have a quick input.
What i want now, is count the no of occurrencys of one state of
Attendence(In, holiday, absent or off) for 5 days in a row. sow, if the
person as been 5 days in a row Absent, is 1 ocurrency.

if more details are neened please contact.
thank you.
 
You should be able to do it with a dsum function, based in something like a
function to which you pass the Person ID and the start date.... something
the following (air code)....

Function BadPerson(id as long, start as date) as boolean
dim crit as string
crit = "PersonID="+cstr(id)+" and When>=#"+cstr(start)+"# and "+ _
"When<=#"+cstr(dateddd("d",5,start))+"#"
BadPerson = (DSum("[Absent]","YourTable",crit) = -5)
end function

.....if you add up yes/no fields then the Yesses count as -1, the Nos as 0.
 
Back
Top