Last Modified

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to keep track of the last time data on a form was
updated/modified. I have it working on all of the subforms except for one.
The subform that it does not work on is a single form with two text boxes in
it. When i type something in the text box and try to move to the next
record, an error pops up. It appears that it cannot access the DateModified
field of the parent. I use the code Me.Parent.DateModified = Now() and i use
it in the after update event. Can anyone help me with this?
 
The approach should work.

You might like to try:
Me.Parent!DateModified = Now()
Using the bang instead of the dot can make the difference if there is no
control named DateModified on the main form (i.e. if it is just a field in
the form's recordset.) You could also address this by adding a text box for
DateModified to the main form (Visible = No if you wish.)

The other option is that the main form could be at a new record, in which
case the code would be attempting to add a new record to the main form. (You
probably want to block this in the BeforeInsert event of the subform.)

If that doesn't work either, it is possible that Access is confused about
the names of things. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect

Then compact the database:
Tools | Database Utilities | Compact/Repair
Explanation of why:
http://allenbrowne.com/bug-03.html
 
Thank you for your help, but none of those work. I don't know if this will
help at all but the i get 2 different run time errors (not at once, but on
different forms). They are a '7878' error and a '-2147352567 (80020009)'
error.
 
AccessError 7878 indicates a concurrency issue. You have some other form,
process, or user that has changed the data, and so this one is out of date
an unable to be saved.

To trace it down, simplify. Close all other forms, tables, and queries.
Temporarily remove subforms. Make sure other users are out. Don't execute
action queries. Make sure nothing is unnecessarily dirtying the record.
Explicitly save in any process that requires the record to be saved (e.g.
moving record, closing the form, applying a filter, ...) And make sure your
JET 4 service pack is up to date:
http://support.microsoft.com/kb/239114

Presumably you did make sure that the code compiles (Compile on Debug menu,
from code window.)
 
I have tried everything, the code works because the same code is being used
on all other subforms on the page (there are 4 or 5). I have just removed
the code for now, because i figure that those fields wont be updated as much
as the others, but i would still like to know how to go about solving this
problem.
 
Okay, if the code works in scenario A, but not in scenario B, there must be
a factor in scenario B that is not applicable to scenario A.

The problem solving technique will be to track down what that factor is, so
you can eliminate it. Tracking it down means simplifying the scenario until
the problem disappears, and then adding things back again until you find the
culprit.

(All the generic suggestions I can give you as to what to look for were in
the last reply.)
 
Back
Top