Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making an After Update - "Date Modified" field...? 1

Status
Not open for further replies.

Tasuki

MIS
Jul 26, 2002
169
US
How can I make it so that when a user modifies or updates a record, a field or label will update with the current date that the form has been modified?

 
do you want to store the modified date in the table?

If so
1) create a modified date field in your table. Add a modified date control to your form, bound to the modified date field.
2) in the 'before update' event procedure for the form you are using, put in something like
me.modifieddate = now
 
How do I make it so that it only shows the date and not the time? Right now, when someone updates an existing record, the modification date shows both the date and time.
 
I have a similar question. I have created a field called Mod_Time and have set its default to Now() and format to GeneralDate. Now I have also created a submit button. I want to make it so that when the button is clicked the date and time is up to date. What's happenning right now is that the time and date is inputed when the new form is brought up.
 
As it turns out, the same solution in the previous post should apply.

The Form_BeforeUpdate event occurs whenever a modified record is about to be written, which seems to be just about what you need in a DateModified field.

So, all you have to do is
1) Bring up your data entry form in Design View.
2) Find the Form BeforeUpdate event in the events tab
3) Select EventProcedure
4) Click the build button (three dots)
5) add the code above (me.ModifiedDate = now())
6) compile and save
 
Thank you so much. It worked...but I have a question. What does "me" stand for?
 
Me is an Access Visual Basic term for the Form in whose module you are writing code.

So, if you are creating an event procedure in a given form, you can use the 'me' keyword to represent the form that 'owns' the event, rather than having to create and assign a form variable.

So, you could say that Me is the equivalent of

dim MyForm as form
set MyForm = forms("TheFormNameYouAreWorkingWith")

Me is especially handy when dealing with forms that are nested within other forms.
set MyForm = forms("Form1")("Form2").form
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top