Solved

Need a simple Button to Timestamp

Posted on 2012-12-30
7
416 Views
Last Modified: 2012-12-30
Hello,  I am trying to get a button to drive a date/timestamp (mm/dd/yyyy 00:00:00) of a field in Access 2010.  I can't seem to figure it out, and however it seems like something I should be able to find by googling or watching YouTubes on Access..... I have had zero luck finding it.  (probably because its so simple :)

Thanx in advance!

sc
0
Comment
Question by:Gocsteve1
7 Comments
 
LVL 21

Expert Comment

by:Tapan Pattanaik
ID: 38731605
Hi Gocsteve1

Please check this link.

Format the date and time field in Access:

http://office.microsoft.com/en-us/access-help/format-the-date-and-time-field-in-access-HA010341474.aspx
0
 
LVL 75
ID: 38731631
What do you mean by 'a button to drive a date/timestamp' ?

IF ... you are trying to get when a record was created or last modified - then do this (this is just a wild guess as to what you want):

Private Sub Form_BeforeUpdate (Cancel As Integer)

    If Me.NewRecord = True then
         Me![DateCreated] = Now()    ' assuming field is called DateCreated
    Else
        Me![DateLastModified] = Now()  ' assuming field is called DateLastModified
    End If

End Sub
0
 
LVL 28

Accepted Solution

by:
burrcm earned 500 total points
ID: 38731635
If you want a button on your form to fill a field with the date when clicked, in design view, place a button on your form then click cancel to get rid of the wizard. Right click the button, select properties (if not already open), look down the list for "On Click". In On Click, click the arrow, select Event Procedure, and click the ellipsis(...). This will open a code area. Type [yourfieldname] = Date where yourfieldname is the field you want to fill in. Save and try it.

Chris B
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:Gocsteve1
ID: 38731642
This is a simple schedule database.... I'm adding a start and stop button to track the work associated with the task shown (the other fields)

 There is no other data being manipulated, so I need these two buttons to stamp 2 fields.  First now() is the start of the task, the second at the completion of the task.  Make sense?

There are 17 tasks this admin is performing, and I'm trying to understand how long they take.

SC
0
 

Author Comment

by:Gocsteve1
ID: 38731653
Just to add more clarity....

I only want a start and stop button on my form that link to the start and stop time fields....pressing the start date time stamps to the start time field..... Pressing the stop button date time stamps to the stop time field.
0
 
LVL 75
ID: 38731689
Private Sub btnStart_Click()
    Me![YourStartTimeFieldName] = Now()
End Sub

Private Sub btnStop_Click()
    Me![YourStopTimeFieldName] = Now()
End Sub

This will put the values in a field in your table. If you are just talking about a text box on a Form (and maybe also storing in a field):



Private Sub btnStart_Click()
    Me("YourStartTimeFieldName") = Format(Now(), "mm/dd/yyyy 00:00:00")
End Sub

Private Sub btnStop_Click()
    Me("YourStopTimeFieldName") = Format(Now(), "mm/dd/yyyy 00:00:00")
End Sub
0
 

Author Closing Comment

by:Gocsteve1
ID: 38731711
Perfect!  Simple steps if you know where to look :)

Thanx.

sc
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now