A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Automatic update of Date fields, Access 2003



 
 
Thread Tools Display Modes
  #1  
Old September 2nd, 2004, 05:05 AM
HeinzD
external usenet poster
 
Posts: n/a
Default Automatic update of Date fields, Access 2003

I would like to add a field to my Customer Contacts table that automatically
sets to the date the record was entered plus another date field that resets
automatically to the date a record is altered. Can I do this and how?
  #2  
Old September 2nd, 2004, 05:16 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

The creation date is easy. Just add a field to your table, and set its
Default Value property to:
=Date()

The modification date can only be achieved if you update your data through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"HeinzD" wrote in message
...
I would like to add a field to my Customer Contacts table that
automatically
sets to the date the record was entered plus another date field that
resets
automatically to the date a record is altered. Can I do this and how?



  #3  
Old September 2nd, 2004, 07:15 AM
HeinzD
external usenet poster
 
Posts: n/a
Default


Thanks Allen,

how do I do this:

The modification date can only be achieved if you update your data through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.



"Allen Browne" wrote:

The creation date is easy. Just add a field to your table, and set its
Default Value property to:
=Date()

The modification date can only be achieved if you update your data through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"HeinzD" wrote in message
...
I would like to add a field to my Customer Contacts table that
automatically
sets to the date the record was entered plus another date field that
resets
automatically to the date a record is altered. Can I do this and how?




  #4  
Old September 2nd, 2004, 07:30 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

1. Open your form in design view.
2. Open the properties box (View menu).

3. Making sure the Title of the Properties box reads "Form" so you are
looking at the properties of the form, not those of a control, choose the
Before Update property on the Events tab.

4. Set the Property to
[Event Procedure]

5. Click the Build button beside this. Access opens the code window.

6. Make it read like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourDateFieldHere] = Date
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"HeinzD" wrote in message
...

Thanks Allen,

how do I do this:

The modification date can only be achieved if you update your data
through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.



"Allen Browne" wrote:

The creation date is easy. Just add a field to your table, and set its
Default Value property to:
=Date()

The modification date can only be achieved if you update your data
through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.


"HeinzD" wrote in message
...
I would like to add a field to my Customer Contacts table that
automatically
sets to the date the record was entered plus another date field that
resets
automatically to the date a record is altered. Can I do this and how?



  #5  
Old September 3rd, 2004, 01:57 AM
HeinzD
external usenet poster
 
Posts: n/a
Default

Thanks Allen,
that worked beautifully. Great help.

"Allen Browne" wrote:

1. Open your form in design view.
2. Open the properties box (View menu).

3. Making sure the Title of the Properties box reads "Form" so you are
looking at the properties of the form, not those of a control, choose the
Before Update property on the Events tab.

4. Set the Property to
[Event Procedure]

5. Click the Build button beside this. Access opens the code window.

6. Make it read like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourDateFieldHere] = Date
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"HeinzD" wrote in message
...

Thanks Allen,

how do I do this:

The modification date can only be achieved if you update your data
through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.



"Allen Browne" wrote:

The creation date is easy. Just add a field to your table, and set its
Default Value property to:
=Date()

The modification date can only be achieved if you update your data
through a
form. Use the BeforeUpdate event procedure of the form to set the field's
value to Date.


"HeinzD" wrote in message
...
I would like to add a field to my Customer Contacts table that
automatically
sets to the date the record was entered plus another date field that
resets
automatically to the date a record is altered. Can I do this and how?




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Acess 2002 Service Pack 3 J. Haney General Discussion 2 July 29th, 2004 12:59 AM
Useless Access 2003 tired, angry, sucidial and bored General Discussion 10 July 21st, 2004 11:52 PM
Publisher 2003 hotfix package Update (KB 838901) Brian Kvalheim - [MSFT MVP] Publisher 0 May 7th, 2004 08:38 PM


All times are GMT +1. The time now is 03:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.