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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date

Status
Not open for further replies.

mary555

Programmer
Nov 9, 2005
185
CA
How do I get a textbox to work so that if a user enters a time (short time with input mask) that the current date will automatically be with it. If the time the user enters is after midnight, then the date with it should be correct day as well...
 
I'm not sure exactly what you want. I expect that you could use the after update event of the text box to add the date to the text box value:
Code:
   Me.txtMyTextBox = Date() + TimeValue(Me.txtMyTextBox)

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
In the afterupdate event of the textbox control put:

me.textboxname= date() + timevalue(me.textboxname)

 
thanks, that works.
now i just need it so that if the time they enter is after midnight but the current time is before midnight, then the date will be date + 1...is there an easy way to do this without a huge if statement?
 
You will have to define some limits.

Every time is both 'before midnight' AND 'after midnight'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top