Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need a simple Button to Timestamp

Posted on 2012-12-30
7
Medium Priority
?
423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

670 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