Set Default value Date per the time of day

Bigmo2u

Registered User.
Local time
Yesterday, 23:47
Joined
Nov 29, 2005
Messages
200
I have search for an answer on this question.

What I am trying to do is set the default value =Date() until 11:00am and then I want the date to covert to the next day.

Can anyone please help me with this or is this even possible?
 
Yes that is possible do you have a startup form or switchboard in your database? If so you will need to use the forms on timer event to see if it is past 11:00 am and if so create a tabledef of the table which contains the field that you want to change the default value and change the default value to Date()+1.
 
KeithG - thanks for the response, but you have lost me. I have startup form but how do I put it on a timer and then how to I write it look at that timer.

will this slow down my forms/data entry?
 
Are you trying to change the default value of a text box on a form or a field in a table?
 
I am just trying to do it in just the form.
 
RG - That is what I am looking for. If you have time can you break that down for me as to what ("h", 13, now())) means.

"h" means Hour, right

13 is = to 1pm

So the date will change every day at 1300??? What is timeit going off of? Is it the time on the individuals' computer?

Once again you are are awsome RG......
 
You can look up DateAdd() in the VBA help for a complete explanation but basically the code is adding 13 hours to the current datetime for the machine it is running on and then Int() is stripping off the time component. This will cause the date to change a 11:00 AM instead of midnight.
 
I know I am asking for a lot now, but is there a way to make it only for dates Monday thru Friday?
 
You could use an if statement with the weekday function to return what day it is.


if Weekday(Date)<>1 and Weekday(Date)<>7 then
.....
.....
end if
 
KeithG - But I still need it to automatically advance the day at 11:00 am every day as well. How do I write that into it?
 

Users who are viewing this thread

Back
Top Bottom