Solved

Need a simple Button to Timestamp

Posted on 2012-12-30
7
419 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Combobox row source 2 20
deduplicating based on criteria 2 21
Trying to force an answer in a combobox 7 18
Access Delete Query Not Working 13 30
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

773 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