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
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.