Default date

  • Thread starter Thread starter bthomps2
  • Start date Start date
B

bthomps2

Guest
I need my default date in my form to use today date but I have to define todays date as being between 6.am today and 5.30 am the next day..

Here is an example..I input a record at 6.30am on Wednesday the 17.. Someone comes in on the night shift and inputs a record at 1am the next day thurday the 18th.. I want the default to be the previous days date of the 17th.. When the day shift comes in the next day the 18th and adds a record after 6am then it will show as the 18th..

thanks in advance for any help on this.
 
You will need a custom function to calculate this. Are you familiar with VBA?
 
b,

This for the default value will give you "tomorrow" if it is
after 6:00 PM. Instead of "h". But it is the general idea.

=IIf(DatePart("h",Now())>17,Date()+1,Date())

Wayne
 
Default Date

I am trying to have anything from 6am to 5am the next day show as one date. If today is the sept 19 then anyone who adds a record after 12.00am until 5am should still be defaulting to the date of the 19th.. I changed your code abit to make it fit my needs but it is telling me I have a syntac error.. Here is the new code...IIf((DatePart("h", Now()) > 0 & < 5), Date() -1, Date())

Any thoughts on what I am doing wrong..

thanks
B
 
b,
I think that you can use the Between operator
here:

Code:
IIf(DatePart("h", Now()) Between 0 and 5, Date() -1, Date())

If it won't recognize it, you would have to repeat the
DatePart As Follows:

Code:
IIf(DatePart("h", Now()) > 0 And DatePart("h", Now()) < 5, Date() -1, Date())

Wayne
 

Users who are viewing this thread

Back
Top Bottom