Solved

How use form command button to enter date and time into a table

Posted on 2014-04-16
2
2,818 Views
Last Modified: 2014-04-16
I have a form with a command button on it.  When the user clicks on it a field named "StartTime" in the bound table gets a value entered that represents the current date and time.  

Like:  4/16/14 14:32:08 PM


How can I do this?  I assume the field property in the table needs to be General Date.

--Steve
0
Comment
Question by:SteveL13
2 Comments
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40005020
In the click event of the button:

Me.YourDateField = Now()

If this is a required field, set the field to required in the table design.  If it is only sometimes required, you need to verify it in the Form's BeforeUpdate event and cancel the event if the user has not pressed the button.  

Also, if you don't want the user to be able to type in an old date/time, lock the field so that only your button can populate it and the user just can't type into it.
1
 

Author Comment

by:SteveL13
ID: 40005027
Perfect!!!!   Thank you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

791 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