.Oldvalue in a subform

  • Thread starter Thread starter joshpa
  • Start date Start date
J

joshpa

I am trying to get the "oldvalue" of a field on a
subform. Here is my code.

Private Sub Signing_Status_Combo_Box_AfterUpdate()
Dim stOldStatus As String
stOldStatus = Forms![S-Signings Subform]![Signing
Status].OldValue

I am getting an error that "S-Signings Subform" cannot be
located.

Here is some background information.
"S-Signings Subform" is the name of the subform I am
working on.
"S-Signing Summary" is the name of the form the subform is
on.
"Signing Status" is the name of the field I need the old
value for. Basically, after an update to the field, I
want to compare the old value with the new and do some
caluculations based on that. If there is anyway to get
the oldvalue method to work, or to get the old value and
the new value another way, I would really like to know.
Thank you for any help you can give me.
 
A subforms is not a member of the Forms collection. Instead, it must be
referenced from the main form which contains it.

Try this:
Forms![S-Signing Summary]![S-Signings Subform].Form![Signing
Status].OldValue

Note that here, "S-Signings Subform" is the name of the *control* that
contains the subform, which is not necessarily the same as the name of the
subform object.

If the combo box which uses this AfterUpdate code is on the subform, or even
on the main form, then the reference is simpler.

From the subform:
Me![Signing Status].OldValue

From the main form:
Me![S-Signings Subform].Form![Signing Status].OldValue
 
Back
Top