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

Requery in subform causes Main Form to receive focus

Status
Not open for further replies.

topdesk123

Programmer
Sep 27, 2001
76
US
Good morning!

I have a main form with two sub-forms, Subform1 updates the information in Subform2 and the Main Form using the requery event after the record is updated. Unfortunately, after each requery the cursor goes to the first field in the Main Form. I need it to stay in Subform1 because additional records will be entered. I have tried using setfocus after the requery - which works, except it's not the correct record that was currently being worked on.

Any ideas? Need more information?

THANK YOU!!
topdesk123
 
If you were on the last record then
Docmd.GoToRecord, acLast ?

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Hi Zameer,

Thank you for your response - I have tried that also, but after the requery it goes to the last record of a different set, if that makes any sense.

The Main Form are jobs that need to be scheduled. Subform1 is where the manager schedules employees to each job (there are usually 2 or 3 employees assigned to a job) I accomplished this by using continuous forms related to the Main Form by BidID. Subform2 shows the overview of the employees schedules. The requery happens after the date is entered on Subform1 so that it shows the job as scheduled in the Main Form and updates the information in Subform2. So everytime an employee is entered with a date - the cursor pops back up to the Main Form. Clear as mud?

Thanks again!
topdesk123
 
How about this?
Code:
Me.MySubform.SetFocus
DoCmd.GoToRecord , , acLast

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top