Last record on continuous subform

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

Guest

This is what i have:
If Me!frm_GSCRecurrent.Form!RecurrentTraining + 390 < Date Then
Me.Text24.ControlSource = "='Expired'"
Else: Me.Text24.ControlSource = "='Current'"
End If

This works well. The subform named "frm_GSCRecurrent" is a continuous
subform on a main form (the Text24 textbox is located on the main form). It
keeps track of recurrent training dates (field "RecurrentTraining"; that is
the only field on the subform, besides the IDrecord field linked to the main
form).
What i want is for the function to consider ONLY the last record on the
subform. So far, it takes under consideration the record where the cursor is.
How can i make it consider the last record (RecurrentTraining) of the subform?

Thanks guys for your help.
 
Hi,
i think best way is to build a query, based on a same table, and get a value
from there
 
If you need to access the last record in a subform, you can use the
..RecordSetClone method to snoop around the recordSet and get the
information for the last record. Specifically,

Set rsClone = me.RecordsetClone
rsClone.moveLast

Once you execute the .moveLast statement, the rsClone recordSet will be
set to the last record. At that point you can use

rsClone("fieldName")

to get the value in the named field.

Remember that ME refers to the mainForm, you'll need to adjust it to
clone the subforms recordset.
 
Which of course is the RUSSIAN way of doing things. :)
See my post for an alternative - the AMERICAN way.

(Who says the cold war is over?)
 
Your welcome.

David H - aka your friendly neighborhood, decadent, western capitalist pig
 
Back
Top