Jonathan Mulder said:
Let me jump in here...
I have a similar situation, and I was able to set focus
using the code you have below. But it seems to set focus
to the TOP row of data in a subform (i.e., if you're
using the subform to display several related records).
But I want to set focus to possibly the third or sixth
row (i.e., related record). I don't see how to set focus
on anything but the top row. I'm thinking "array" here,
but am not really sure...
So how do you know which record you want to make current? That's really
what you're doing in this case -- navigating to a specific record. If
you have the primary key of the record, you can use a variety of
techniques to find it. If you want to go to a specific record number,
well, that really isn't a meaningful concept in a relational database,
but you can in fact go to records by number. If you want to go to the
last record, or to the "new" (blank) record, that's equally available.
Most of these things can be done by navigating in the subform's
recordset or recordsetclone, or by setting the focus to the subform and
then executing the DoCmd.GoToRecord method, as in
Me.sfSubform.SetFocus
DoCmd.GoToRecord acActiveDataObject, , acLast