[AccessD] Old problem - forgotten the answer

Steve Schapel miscellany at mvps.org
Sun Nov 18 11:43:39 CST 2007


Stephen,

Therefore, you could do it within the same code that does the Requery. 
It would make it a lot easier to provide help if you could reveal the 
names of the forms, and info about the subform's primary key, and the 
code you have so far.  But possibly an adaptation of the code Rocky 
suggested would do it, e.g....

    DoCmd.RunCommand acCmdSaveRecord
    lngClientGroupID = Me.TheSubformsPrimaryKey   ' assumes number data type
    With Forms!YourForm!YourSubform.Form
        .Requery
        .RecordsetClone.FindFirst "TheSubformsPrimaryKey = " & 
lngClientGroupID
        If .RecordsetClone.NoMatch Then
           MsgBox "Could not return to selected record", vbExclamation
        Else
           .Bookmark = .RecordsetClone.Bookmark
         End If
    End With

Another option woulkd be to use the main form's Activate event. You 
described the editing form as a dialog box form.  If it is truly a 
dialog form (i.e. it is opened from the main form in acDialog mode), 
then possibly the main form's Activate event would be more applicable.

Regards
Steve

Stephen wrote:
> More info.  The Requery is done from the dialog box form.  It requeries
> the invoking form.  
> 



More information about the AccessD mailing list