By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,838 Members | 2,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,838 IT Pros & Developers. It's quick & easy.

Set focus to particular record using Continuous Forms

P: n/a
This one is stumping me!

I have a Form/Subform arrangement. The main form is set as a Single
Form and the sub form is set as Continuous Forms.

On the Form_AfterUpdate event of the subform, I run some code that
affects the main form which forces focus *away* from the subform and
puts it to the main form.

I need to keep focus on the subform when the code in the
Form_AfterUpdate event finishes. Sounds simple enough, right!? I
tried a Me.CtrlName.SetFocus in the subform after I'm done running my
code. However, in continuous forms, it defaults back to the *first*
row. I'm wanting to set focus back to a specific row/instance in the

I tried DoCmd.RunCommand acCmdRecordsGoToLast and the like, but I want
to get focus to where I last left off, not the first, last, new, etc.

I do have a hidden unique identifier if that would be used as part of
the solution.

Any thoughts? If you need more info, let me know!


Mar 30 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Well, I think I got it figured out. It was easier than I thought...

Dim lngPosition as Long

lngPosition = Me.CurrentRecord ' capture index position of record
currently selected

' *** do my code where my subform loses focus to parent form ***

Me.ControlName.SetFocus ' go back to sub form

Me.Form.Recordset.Move lngPosition ' navigate back to original
record position
End Sub

I still have some debugging to be sure its fine tuned correctly to
account for all possible situations, but this got me 90% of the way
there. I guess it was easier than I thought (Me.CurrentRecord and
Me.SelTop didn't jump out at me at first!)


Mar 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.