?
Solved

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

Posted on 2014-04-16
2
Medium Priority
?
3,145 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
[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
2 Comments
 
LVL 38

Accepted Solution

by:
PatHartman earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

770 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