Sub-form focus keeps going back to first record

E

EJ

I have a logic in a sub-form that needs to change the focus to the main form.
When the logic goes back to the sub-form the focus goes back to the first
record instead of the current record. I have tried saving the record number
and then using the gotorecord command and I can see the cursor jump to the
correct record, but then it goes back to record one. What could be causing
this and how do I get around it?
 
O

Ofer

Do you have a requery after you move to the right record"?
the requery will referesh the form, and then moves to the first record.

If so, perform the requery and then move to the next record
 
E

EJ

I didn't have a requery, but I did have a refresh of the main form. I got rid
of it temporarily and the problem was solved. The weird thing is the refresh
of the main form was right before I returned focus to the sub-form and went
back to the correct record.

But now I know what is causing the problem so I can find a work-around.
Thanks loads.
 
J

Jim Doherty

You need to save the subforms bookmark property in a variable before you
lose subform focus, refresh the main form then set the subform bookmark
propery back to the variable ie Forms!subformname.form.bookmark=variablename
this will return the pointer to the correct record

Jim
 
Top