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

Insert time

Status
Not open for further replies.

toffa

Programmer
Aug 24, 2004
77
AU
Its been a while since i have been here but just wanted to ask some advise.

I have a form for notes it is a subform to the main form. I wanted to insert the current time into a feild just by double clicking the feild and then if i need to change it i can..

I have tried this but have i am getting the date only what would be the code for just the time..

Me!YourTextBoxName = Int(Now())

Chris
 
Chris

...Almost

For the double click event procedure...

If the textfield is to be used as a Date / Time for a record or in calcualtions...

Me!YourTextBoxName = Now()

This inserts the date and time -- the date is the interger component and the time is the decimal component.

Then format the text box as a Time format -- there are several offered within the form properties (View -> Properties).

If this is just for display...

Me!YourTextBoxName = Format(Now(), "hh:mm:ss")

If you really want to get away from the Date integer value...
Me!YourTextBoxName = Format(Now - Date, "hh:mm:ss")

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top