How do I get split form to go to a specific record after processing the after update event?
Posted on 2008-11-10
I have created a form with a combo nbox that allows users to nominate the status of a record. When they change the status I need to do some processing on the record, requery the form (as the record list may have changed) and return focus to the record that the user was working on. I have created the After Update event but I cannot get it to go back to the desired record so I have gone backwards and found the offending line of code but I still don't understand why this happens or, more importantly, how to fix. Following is the stripped down code that won't work. Basically if I step through the code it seems to work as it should finding and bookmarking the record but when it has finished running the form's focus is on the first record not the one that I want.
Me.Dirty = False 'save changes
lAssignmentId = 3646 'I have manually entered here but in my full code this is set by code
Me.Form.Requery 'this appears to be the offending line. If I remove it the desired record remains in focus
'move record pointer to appropriate record
If Nz(lAssignmentId, 0) <> 0 Then
Set rs = Me.RecordsetClone
rs.FindFirst "AssignmentId = " & lAssignmentId
If Not rs.NoMatch Then
Me.Recordset.Bookmark = Me.RecordsetClone.Bookmark