"William Wisnieski" <ww********@admissions.umass.edu> wrote in message news:<3f********@news-1.oit.umass.edu>...
Hello Everyone,
Access 2000
I have a main form with a continuous subform. On the main form I have a
text box that references a field on the subform. What I'd like it to do is
show the value in the field of the last record entered on the subform. But
what its doing is referencing whatever record the user clicked on last
before closing all the forms. Also if the user cleared the subform field, I
would like the text box on the main form to show a null value as well.
Here is what I have for the control source of the text box on the main form
=[Forms]![frmStudentRecord]![sfrmCommunication]![CommStatus]
Thanks for your help.
William
Hi -
Maybe instead of pulling the data from the subform into the main form
you should "push" it instead. Or some combination. From the subform,
on the form_insert event, push the value back onto the parent. Or
maybe use the CommStatus.AfterUpdate event. To reach your field, you
would use Me.Parent("NameOfField"). I'm not sure what the "bang"
equivalent is. I never use them.
If it is really vital to identify the last record inserted, you need a
way of identifying it. Are you using an autonumber for the ID or key
field? That's usually a good practice, or else add a date field to
track when the record is inserted, then use a "SELECT MAX ..." sql
string for a recordset to get the value.
Hope this helps.
Phil Freihofner