Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Tips & Tricks

New Tips Added Weekly!
Click here to get on our Mailing List

   
 

Default Value

Insert the current date and time with the default value field property

In this Microsoft Access video tutorial, you will learn how to use the Default Value property in your tables to automatically insert the current date and time into new records. This is great for work logs, order entry, or anything else that requires a date/time stamp. You can learn more about the Default Value property, and many of the other table field properties in my Access 2010 Beginner Level 3 Tutorial.
 


Have you ever wanted to automatically insert the current date and time into your Microsoft Access database records? You can do this with the Default Value property. You can use this for work logs, order entry, time tracking, or anything else that requires a simple date/time stamp to be automatically entered each time you create a new record.

Take, for example, a simple table with three fields: an ID (AutoNumber), a DateTime field (Date/Time data type), and a Description field (Text). As you enter records into the table, you are forced to manually type in the current date and time for each record. This can be quite laborious, even with the Date Picker button, because you still have to type in the time. It would be nice if there was a way for Access to automatically insert the current date and time for you.

Open your table in Design View. Click on the DateTime field and notice the list of field properties at the bottom of the window. Find the Default Value property. The Default Value is the value that a new record starts out with. You can change it if you want, but Access will create new records with this value. You can set the Default Value to a static value. For example, if most of your customers are from New York, you could set the Default Value for a State field to �NY�. In this case, we want the current date and time to be inserted.

In order to have a Default Value that inserts the current date, type the following into the Default Value property:

Date()

This is the Date Function. Notice the empty parentheses. This indicates to Access that you�re dealing with the Date Function, and not just the word �Date.� The Date Function returns the current date and places it in this field. Since Date() doesn�t return the time, we�ll get today�s date at midnight. If you save the table and switch over to Datasheet View, you�ll see that the next new record will be created with today�s date. Now, we want the current date with the current time. So instead of Date() type in:

Now()

The Now Function returns the current date along with the current time. This will allow you to create a date/time stamp for your record. Each time you enter a new record, the date and time are inserted automatically for you.
 

 


By Richard Rost   Richard Rost on LinkedIn Email Richard Rost
Click here to sign up for more FREE tips

 

 

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 11/11/2024 8:32:20 AM. PLT: 0s