forms: modification date field

K

Kamil

Hi
I'd like to auto fill a field called "Update", which is a date of
record's last modification. Modifications are only entered manually
via form.
Which event should I use? I also want to have the possibility to
cancel changes (like pressing escape key).
I've tested AfterUpdate, but when I want to move to the next record
(after updating current) I get an error message: "You can't go to the
specified record".

Private Sub Form_AfterUpdate()
Me!DataAkt = Date
End Sub

Please advice

Best regards,
Kamil
 
K

Kamil

Use the BeforeUpate event of the form.

BTW, Update is a reserved word, so not a good name for a field. Here's a
list of the names to avoid:
   http://allenbrowne.com/AppIssueBadWord.html
There's too many to remember; refer to the page when creating fields.

"Update" is a translation from original Polish name, so it's not a
problem. But thanks for the link.
About BeforeUpdate - now I have new error: "The expression On Current
you entered as the event property setting produced the following
error: Procedure declaration does not match description of event or
procedure having the same name."
On Current is responsible for displaying image in a form (if
available).
When I press "Next" button (command button) I have similar error but
instead of On Current it indicates that On Click produces an error.

BeforeUpdate contains just Print "test" line.

when I comment out the beforeupdate sub everything is ok.

What is the problem?
thanks
 
A

Allen Browne

Does the code compile (Compile on Debug menu, in the code window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
Use the BeforeUpate event of the form.

BTW, Update is a reserved word, so not a good name for a field. Here's a
list of the names to avoid:
http://allenbrowne.com/AppIssueBadWord.html
There's too many to remember; refer to the page when creating fields.

"Update" is a translation from original Polish name, so it's not a
problem. But thanks for the link.
About BeforeUpdate - now I have new error: "The expression On Current
you entered as the event property setting produced the following
error: Procedure declaration does not match description of event or
procedure having the same name."
On Current is responsible for displaying image in a form (if
available).
When I press "Next" button (command button) I have similar error but
instead of On Current it indicates that On Click produces an error.

BeforeUpdate contains just Print "test" line.

when I comment out the beforeupdate sub everything is ok.

What is the problem?
thanks
 
K

Kamil

Does the code compile (Compile on Debug menu, in the code window)?

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html





"Update" is a translation from original Polish name, so it's not a
problem. But thanks for the link.
About BeforeUpdate - now I have new error: "The expression On Current
you entered as the event property setting produced the following
error: Procedure declaration does not match description of event or
procedure having the same name."
On Current is responsible for displaying image in a form (if
available).
When I press "Next" button (command button) I have similar error but
instead of On Current it indicates that On Click produces an error.

BeforeUpdate contains just Print "test" line.

when I comment out the beforeupdate sub everything is ok.

What is the problem?
thanks

it doesn't. error was in the sub declaration (I forgot about the
arguments in BeforeUpdate - Cancel).

thanks!
 

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