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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Managing focus between 2 subforms

Status
Not open for further replies.

SABS

Programmer
Nov 21, 2003
14
CA
I have a data entry form where the user enters timesheet records on subform 1 (bound to a table) and subform 2 (bound to a query) shows totals for the hours entered (amongst other things).

After each time entry I would like the totals on subform 2 to update but would like to keep the focus on subform 1 on the appropriate cell. However,if I run a requery to update the totals the focus returns to the first time entry record in subform 1. Can someone tell me how I "bookmark" my location in subform 1 and return to it appropriately (or some other solution that I'm not aware of)?

Thanks!
 
Hi SABS,

I'm new at this, but this is something I've done.

Try storing the key field value from subform1 in a hidden text box on the main form somewhere, maybe after entering the new record but before requery. Let's call it field1.

Put this after you requery.

Forms!MainForm!Subform1.Form.RecordsetClone.FindFirst "[KeyField] = " & Me!Field1

I'll check in later.
 
Thanks p4clone. I've done something like that before as well, but I have two problems with that (that we might overcome??).

First is that I don't have a key field in the table off of which subform1 is bound (although I COULD add one if I need to).

The second issue is, because this is a data entry app where the user doesn't want to be adding any extra clicks or switching to the mouse from the keyboard, I need to return to the exact field that the user was navigating to, e.g. if the down-arrow was clicked I need to go to the new record in the current field. Any advice?
 
You maytake a look at the Screen.PreviousControl property.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top