Solved

Need a simple Button to Timestamp

Posted on 2012-12-30
7
421 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 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

710 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