[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Whats New!
Need a database?
Tips via email
Learn VBA
Questions Answered
Access Tips Index
What is MS Access

Auto Date Entry

 

Auto Date Entry

 

Question

I'm busy with a database for our school. On my 'Absenteeism' form I need to insert today's date into a field. I want to click on a command button that will automatically add today's date into the table field.

 

Answer

To do what you ask:

 

Add a command button to your form, but click on the Cancel button when the wizard commences.

 

Then right click on the command button and select properties from the drop down list.

 

In the properties window, click on the event tab, and place your cursor next to 'On Click', then click on the '...' button that should now appear.

 

Choose code builder.

 

The coding window will open with two lines of code similar to below:

 

******

 

Private Sub Command213_Click()

 

End Sub

 

*****

 

In between these two lines of code type the following.

 

Me!NameOfDateField = Date

 

Change 'NameOfDateField' to the name of the field where you wish to display today's date.

 

Today’s date will now be displayed in the appropriate field.

 

I hope this tip, Auto Date Entry, is of some benefit to you.

 

Do you like this tip? Subscribe to my Newsletter to receive tips via email. Click Here to subscribe.

 

www.simply-access.com (c) 2002 - 2009