Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check checkbox when the difference between start and end date

Status
Not open for further replies.

Lightlancer

Programmer
Jul 18, 2008
88
NL
hey all,

when a call is being made, it will automaticly fillin a start date in a field, when the call ends, the end date will be filled in, in a field, also there is a checkbox, and when de call ends (user clicks a button wich will end a call, date will be filled in AND then......) a VBA code must look if the difference between start & end date is more then 82 minutes or 164 minutes.

Fieldnames:

Startdate fieldname: Startdatum
Enddate fieldname : Einddatum
checkbox fieldname : CheckSLA

Any help would be gratefull......


Greetz

Lightlancer
 
forgot to tell that when the difference is more then 82 or 164 minutes then the checkbox must be checked....


Greetz
lightlancer
 
sharing Remous confusion. Perhaps OP (lightlancer) means:

Code:
dim intduration as integer

intduration = datediff("n",startdatum,einddatum)
if intduration between 84 and 164 then
   me!CheckSLA=true
endif

ie., the check should be true if the condition is between the times?
 
almost right guys.....

but i fixed it with this code:

Code:
Me.einddatum = Now()
   If DateDiff(n, [begindatum], [einddatum]) >= 82 Then
   Me.SLA1 = True
   Else
   If DateDiff(n, [begindatum], [einddatum]) >= 165 Then
   Me.SLA2 = True
   Me.SLA1 = True
i also forget to mention that when its more then 165 SLA2 must also be checked, see code.

i didnt try to test it, but i will tonight.........
 
you could also tidy up by using:

Code:
Me.einddatum = Now()
me.SLA1 = DateDiff("n", [begindatum], [einddatum]) >= 82 
me.SLA2 = DateDiff("n", [begindatum], [einddatum]) >= [red]164[/red]

Just to look better and if the difference between 164 and 165 is contractual.

JB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top