Calculated time interval afterupdate

KCA

Registered User.
Local time
Today, 18:49
Joined
Mar 29, 2002
Messages
24
On my form I have a calculated control that holds a time interval, calculation is done in the query which works ok. The field is disabled.

I have a second control, delay code( also locked) that I want to make active if time interval is >5 minutes. I've set the field property to short time format.

So I looked on the forum and messed around with what I could find that came close and came up with below code. it doesn't give me errors, but it doesn't change a thing as well. I tried putting the code in the afterupdate event of the delay field and the form afterupdate, without result.
I have the feeling it has something to do with format of the time, but don't know how to address this. When I put #00:05# it changes into #12:05:00 AM#. I'm learning every day, but stuck again with this one...


If Me.Delay > "00:05" Then
[Delay code].enabled = True
Else: [Delay code].enabled = false
End If

Thanks, Koen
 
Ok, I can have part of it working already using this code in the afterupdate event of one of the time fields that are part of the calculation :

If Me.Delay > "0,00347222222222221" Then [Delay code].Enabled = True
If Me.Delay <= "0,00347222222222221" Then [Delay code].Enabled = False
End If

What I did so far, is change the format of the delay field to standard, so I get a decimal number. the number in the code = 5minutes.

When I change my time field to get a time difference of more than 5min, the delay code field becomes active.
Now the problem, when I change this value again to a value resulting in a delay of less than 5min, the delay code field stays active.

Any ideas ?

Thanks, Koen
 
I'm bored...so I created it for you...

take a look at the attached zip file.

Should help you out, it uses the DateDiff() property.

HTH
 

Attachments

I like it when you're bored :D

Works great, and without any conversion bullshit.

Thanks, Koen
 

Users who are viewing this thread

Back
Top Bottom