Access 2007 auto update a date field

S

Steve Schapel

Diyisfun,

The article you pointed to is pretty clear, and should work as described.

Do you have a DateModified field in the table that the form is based on?

Did you make a macro like this?...
Action: SetValue
Item: [DateModified]
Expression: Date()

Did you assign this macro on the Before Update event property of the form?

If yes to all these questions, what actually happens when you close the
form after editing data? Nothing at all? Error message? Wrtong entry?
 
G

Guest

Steve
I did not set a macro, I have not set a field within the table, although I
think I should have done so as I would like to produce reports.

My knowledge of both macro's & vba is non existent, thats why I am looking
for detailed help.
Regards
Steve

Steve Schapel said:
Diyisfun,

The article you pointed to is pretty clear, and should work as described.

Do you have a DateModified field in the table that the form is based on?

Did you make a macro like this?...
Action: SetValue
Item: [DateModified]
Expression: Date()

Did you assign this macro on the Before Update event property of the form?

If yes to all these questions, what actually happens when you close the
form after editing data? Nothing at all? Error message? Wrtong entry?

--
Steve Schapel, Microsoft Access MVP
I wish to update a date automatically in a form, after data has been changed.

I have tried to do as the link belows shows, but I am not having any joy.

I do not need the time just the date.

If anyone can write what I need & give me a step by step Or a link, I would
appreciate it.

I have no knowledge of vba

Thanks
 
S

Steve Schapel

Steve,

Fair enough. The problem I had was "I am not having any joy" in your
original post did not give me much of a handle on the nature of the problem.

Ok, if you are going to store the date that a record is modified, then
you will need a field in your table where this can be stored. This will
be the table that your form is based on. So, go to the design view of
this table, and add a new field and name it DateModified. Make it a
Date/Time data type. Ok?

Go to the design view of the form, and look at the Properties. What is
shown in the Record Source property? Is it the table, or does it show
the name of a query? If it's a query, you will need to go to the design
view of the query, and add the DateModified field to the query grid.

Add a new textbox to the form design. Look at the Properties of the
textbox. In the Control Source property, enter the name of the new
field you have just added i.e. DateModified, and also change the Name
property to DateModified.

Open a new Macro in design view, and create it as described before. In
other words, enter SetValue in the Action column, and then in the
properties boxes down below, enter like this...
Item: [DateModified]
Expression: Date()

Close and save the macro.

Back to the design view of the form, look again at the Form properties.
Find the Before Update property. Enter the name of the macro you just
created.

Close and save the form.

Open the form in Form view, change the data in one of the records.
Close the form. Open the table and see if today's date has been entered
into the DateModified field for the record you edited
 
G

Guest

Steve
Yes I would like to store the data, I have followed your instructions up to
'Open a new Macro'.
In the action, I do not have a ‘SetValue’ option, I have
SetDisplayedCatergorires, SetMenuItem, SetProperty, SetTempVar. So am I in
the right place?.
I am in form design, select my DateModified, Create, Macro
Thanks
 
S

Steve Schapel

Steve,

By default, Access 2007 only displays macro actions that can work in
untrusted environments. You will need to go to Macro Design, find the
Show/Hide group on the Ribbon, and click "Show All Actions" button.
After that, the SetValue action should be available.
 
G

Guest

Steve
I have gone to 'Trust Centre' my settings were 'Enable all Macros (Not
recommened etc).
Also
You mention in prev post, Action, Item,
I have Action; Arguments; Comments

Ta
Steve
 
G

Guest

Steve..I have found the show/hide & yes I can now see 'SetValue', when I
select that I can not see 'Item', I have 'Aruguments'.
I hope you havent given up on me.
Regards
SteveB
 
G

Guest

Steve
I have it working at Long Long Last.
I did it from this
http://office.microsoft.com/en-us/access/HA010345351033.aspx

Info For Others
I created a new table and made a copy.
In one version I did it as a Macro. But I could not get that working
In the other Version, I did it as an event procedure.

I wish I could get the macro version working as then I may understand them.

Anyway
A big thanks for trying
Regards
Steve
 
S

Steve Schapel

Steve,

Great to hear that you have made some good progress.

Getting the macro working should not be too difficult. As I mentioned
before, you need to go to macro design view, and then click the "Show
All Actions" button on the Ribbon. I have not understood what your
obstacle with this is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top