Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If No Time Entered in Date Field, Set Time to Now

Status
Not open for further replies.

NMiller007

Programmer
Joined
Nov 15, 2006
Messages
65
Location
US
I have a form which sets a date/time field as now when it loads up. That is working fine. The problem is, when someone overwrites the date with a new one (that is allowed) and they don't enter a time, the field only stores the date. Is it possible to automatically place the Now time in if no time is entered?

I'm using this timestamp as a way to differentiate between records, so I don't want a there to be a bunch of records with just the date stored if the user has to go back and enter a lot of records from say last week.

Thank you.
 
after update, check the field is populated if not, set the field to now with a message box telling the user that they neglected to supply a date.

"My God! It's full of stars...
 
How can I check if just the time portion is Null? I check if the entire field is Null, but what if there is a date with no time?
 
How can I check if just the time portion is Null?
Provided you already used the IsDate function:
If TimeValue(Me![date/time control]) = 0 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
NMiller007 said:
[blue]The problem is, when someone overwrites the date with a new one (that is allowed) and they don't enter a time, the field only stores the date. [purple]Is it possible to automatically place the Now time in if no time is entered?[/purple][/blue]
[ol][li]The Field should be set to [blue]General Date[/blue] to always show the time![/li]
[li]When you enter a date onlyl the time is always 00:00:00, the start of the day in question![/li][/ol]
[blue]Now() is always the current date & time and can't give you the time of any other day! . . .[/blue]

[blue]Your Thoughts? . . . [/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top