Time Calculation

S

smartcookie

I am kind of beating my head over this problem.

I am trying to create a rule by where the user cannot enter data if todays
date is greater than a function date - max time given in a query

So lets say the user has 72 hrs to respond before an event date lets say Jan
1, 2010.

I tried this so far but its not working :

EventDatePlusMaxTime: DateDiff("n",[functiondate]+[maxtime],[functiondate])
 
J

John W. Vinson

I am kind of beating my head over this problem.

I am trying to create a rule by where the user cannot enter data if todays
date is greater than a function date - max time given in a query

So lets say the user has 72 hrs to respond before an event date lets say Jan
1, 2010.

I tried this so far but its not working :

EventDatePlusMaxTime: DateDiff("n",[functiondate]+[maxtime],[functiondate])

Use DateAdd instead of DateDiff, in the form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If Date() > DateAdd("h", [maxtime], [functiondate]) Then
MsgBox "Sorry, time limit has elapsed", vbOKOnly
Cancel = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top