Need time created of last record in the record set

  • Thread starter Thread starter RobUCSD via AccessMonster.com
  • Start date Start date
R

RobUCSD via AccessMonster.com

I have a form that has a continous sub form on it. I want to disallow edits
and additions to the main form based on the timestamp value of the last
record entered in the sub form. I have code to calc the time, If DateDiff
("h", Me.fldTimeStamp, Now) >=2) Then,,,

but I don't know how to get the TimeStampvalue from the last record entered.
(the table has a field named fldTimeStamp with the default value set to Now())
..

Any help would be greatly appreciated. Thanks, Rob
 
RobUCSD said:
I have a form that has a continous sub form on it. I want to disallow edits
and additions to the main form based on the timestamp value of the last
record entered in the sub form. I have code to calc the time, If DateDiff
("h", Me.fldTimeStamp, Now) >=2) Then,,,

but I don't know how to get the TimeStampvalue from the last record entered.
(the table has a field named fldTimeStamp with the default value set to Now())


Not sure where you eant to do this, but try the main form's
Current event:

With Me.subformcontrol.Form.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
Me.AllowEdits=(DateDiff("n", !fldTimeStamp, Now)<120)
End If
End With
 
Douglas said:
DMax("NameOfTimestampField", "NameOfTable")

Simple, but ...

It doesn't allow for the form being filtered. Does Rob want
the latest date in the table, the latest date in the form's
record source, or the date in the last record in form's sort
order.

The question also implies that the form is loading a bunch
of records, which in many situations is a poor practice

After all this thought, the question seems to be at least a
little ambiguous.
 
Back
Top