Software optimize

Let Access enter today's date automatically

Your users shouldn't have to manually type the current date over and over into an Access form. Save them some time and effort by automating the process.

Are your users frequently typing today's date into their forms? You can set the default properties for the date field so that they will never have to type the date again. For example, say you use a form based on the Orders table for entering each day's orders as they are processed. Follow these steps:

  1. Open the Orders table in Design View.
  2. Click on the Date field.
  3. In the Table Properties window, click in the Default text box and enter Date().
  4. Click the drop-down arrow of the Format text box and select Short Date (Figure A).

Figure A

  1. Save the table.

Now, Access will automatically fill in today's date for any new records (Figure B). Any form based on this table will also have the current date entered by default.

Figure B


Miss an Access tip?

Check out the Microsoft Access archive and catch up on other Access tips.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

8 comments
feral
feral

Good tip if utilised in the correct situation however as GB pointed out not so great if the app requires accuracy. It really does come down to suitability to purpose. I love a good Ooops, your forgiven bondin.

dogknees
dogknees

This is a great tip to save people's time and frustration. However, I would suggest people think through whether this is appropriate for their app. As an example, we've recently put together a new Outage database to publish times, reasons and impacts of system outages. The problem is that not all Outages are logged on the day they are occurring. In fact, most aren't. We decided that it was important to make the person logging the outage think about the information they're entering. Not giving them the default in this case is more useful. So, as I said, it's great usability tip, but you should consider whether it's appropriate. Personally, if the default date is incorrect more than perhaps 25% of the time, I'd make them choose it. Hope this is useful to someone!

Tony Hopkinson
Tony Hopkinson

That's the date off the client PC.... Not an issue in this case probably, but it's also the date, the entry was displayed, not the one it was posted to the database. So if say time to the second, or even millisecond is important.... Also bear in mind daylight saving time, if you need to analyse intervals. So if datetime is critical, this is a bad move on several counts. Still if any of this is imporatnt you wouldn't be using access....

ian3880
ian3880

Sorry folks - goofed up - don't seem to be able to delete this posting.

alan
alan

I would agree with the previous message. My preference is to use the Double Click event to add todays date. A simple tooltip or label next to the form control makes the user aware of the option to double click for today.

Dayle1011
Dayle1011

Could you explain how to do that?

Dayle1011
Dayle1011

Thanks for the clarity. I guess I was having a brain poop

mwb78
mwb78

Open the Property Sheet for the date field control and click on the Event tab. Use the On Dbl Click property to define what will happen when the control is double clicked. In this case, I use Code Builder to simply set the date field equal to the current date.