Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set focus on detail section of a sub form?

Status
Not open for further replies.

jebushatescats

IS-IT--Management
Jun 6, 2006
37
CA
Hello all
I have a form called x
a subform within the form called y

the subform y has a header, a footer and a detail section.
The detail section has fields that display values from fields within a table record.

Can anyone tell me how I set focus to the detail line within the detail section of my subform?
 
To move to a specific line, you can use the Recordset of the subform.

For example:
[tt]Me.[Subform Control Name].Form.Recordset.MoveLast

Or

Set rs = Me.[Subform Control Name].Form.Recordset
rs.FindFirst "ID=3"
Me.[Subform Control Name].Form.Recordset.Bookmark = rs.Bookmark[/tt]
 
To set focus on a control in a sub-form, you need to set the subform on focus first, like,

me!y.setfocus
me!y.form!Control1.setfocus

Before that, you can use Remou's code to move to a specific row in the subform first.

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top