• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

How do I get split form to go to a specific record after processing the after update event?

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.Undo
    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
            Me.AssignmentComments.SetFocus
        End If
    End If
0
Rob4077
Asked:
Rob4077
1 Solution
 
Rob4077Author Commented:
Please ignore question
 
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now