This question is in reference to a September 12 posting. I
was given two options by two different people (thank you
so very much) but I cant seem to get either of them to
work. I am almost positive it isn't with the code or
expression, rather with my implementing the code or
expression. I was wondering if I could get
clarification/guidance on how to implement the code and/or
the expression into the form/table properties. (while I am
being so honest, as far as the code goes, I know little
else other than launching the VB Editor window and doin a
copy and paste of what is shown to me...otherwise, I am a
bit lost.) Here is a recap of my initial question (with a
few more specifics)
I have a form that has a date field
entitled "ToBePulledOn". As it is now, the current date is
the default value - Date(). I am looking for an expression
or code that makes the default value for
the "ToBePulledOn" field between the hours of 12:00 AM and
10:29 PM the current date. From 10:30 PM to 11:59 PM I
would like the date field to equal the following days
date. ie Date() + 1.
I received two responses. One containing code and one
containing an expression.
Honestly speaking, I am not entirely sure of how to
implement the code given in a forms "Before Update" event.
When I tried to enter the expression into the default
value I received an error each time I tried to save. The
error message stated there was a format conflict of some
sort and it prevented me from proceeding any further.
Can anyone help?
Here are copies of both the Code and Expression that were
given to me.
>In the Before Update event of the form try something like
>this:
>Dim dteCurrentTime As Date
>dteCurrentTime = Time
>If dteCurrentTime >= #4:00:00 AM# And dteCurrentTime
> <#10:30:00 PM# Then
> 'Do Nothing
>ElseIf dteCurrentTime >= #10:30:00 PM# Then
> txtField2 = DateAdd("d", 1, txtField2)
>Else
> MsgBox "What are you doing here at " & Time & "?",
>vbOKOnly + vbExclamation
>End If
Here is a copy of the expression that was given to me.
>I think this will do that:
>dtfield - (DateDiff("n", CLng(dtfield), dtfield )
> >=22.5*60)
|