G
Guest
I have a button on the form that creates a duplicate record then runs the
code below that should go to the record that was just created. This works
great if I've opened the form and displayed all records. However, if I've
opened the form and filtered the records, the code below isn't working
properly. It navigates to the first record in the filter and doesn't show
the newly created record. I have to close and re-open the form unfiltered in
order to see the added record. Any ideas why this is happening? Thanks.
Public Sub DuplicateRecordRefresh()
With Me.RecordsetClone
' Save this record's key info.
strModel = Forms![CreateDuplicateRecord]![ChooseModel]
strPart = Forms![CreateDuplicateRecord]![ExistingPart]
strNHL = Forms![CreateDuplicateRecord]![NewNHL]
' Requery the form.
Me.Requery
' Position this form to the record
' whose keys we saved.
Me.Recordset.FindFirst _
"[Model#] = '" & strModel & _
"' And [Part#] = '" & strPart & _
"' And [NHL] = '" & strNHL & "'"
End With
End Sub
code below that should go to the record that was just created. This works
great if I've opened the form and displayed all records. However, if I've
opened the form and filtered the records, the code below isn't working
properly. It navigates to the first record in the filter and doesn't show
the newly created record. I have to close and re-open the form unfiltered in
order to see the added record. Any ideas why this is happening? Thanks.
Public Sub DuplicateRecordRefresh()
With Me.RecordsetClone
' Save this record's key info.
strModel = Forms![CreateDuplicateRecord]![ChooseModel]
strPart = Forms![CreateDuplicateRecord]![ExistingPart]
strNHL = Forms![CreateDuplicateRecord]![NewNHL]
' Requery the form.
Me.Requery
' Position this form to the record
' whose keys we saved.
Me.Recordset.FindFirst _
"[Model#] = '" & strModel & _
"' And [Part#] = '" & strPart & _
"' And [NHL] = '" & strNHL & "'"
End With
End Sub