G
Gerard
Hey all,
I am running SQL 2k with Access 2k. I am using SQL
Server with Access as the front end for the forms. I have
code in Form_AfterUpdate that forces a Recordset.Requery
when a record is added so that the record just added
appears in the recordset with it's joins, and thus appears
on the form correctly. This works fine, but after
Form_AfterUpdate executes something else is fired and
Access goes to the last record in the recordset(it assumes
that's where the record just added is). Well after
the .Requery, the record no longer appears at the end of
the recordset, it is now in it's OrderBy location, so
Access is going to the wrong record. I can't find where
or how this .MoveLast is being executed, nor can I
suppress it. It goes to the last record as soon as the
End Sub executes in Form_AfterUpdate. Below is the Code
for the Form_AfterUpdate. Any help is greatly appreciated
as always.
Thanks,
Gerard
--------------------------------------------------------
Private Sub Form_AfterUpdate()
Dim lngHomeID As Long
lngHomeID = Me.Homeid
Form.Recordset.MoveLast
Form.Recordset.MoveFirst
Form.Recordset.FindFirst ("[HomeID] = " & lngHomeID)
Form.Refresh
End Sub
I am running SQL 2k with Access 2k. I am using SQL
Server with Access as the front end for the forms. I have
code in Form_AfterUpdate that forces a Recordset.Requery
when a record is added so that the record just added
appears in the recordset with it's joins, and thus appears
on the form correctly. This works fine, but after
Form_AfterUpdate executes something else is fired and
Access goes to the last record in the recordset(it assumes
that's where the record just added is). Well after
the .Requery, the record no longer appears at the end of
the recordset, it is now in it's OrderBy location, so
Access is going to the wrong record. I can't find where
or how this .MoveLast is being executed, nor can I
suppress it. It goes to the last record as soon as the
End Sub executes in Form_AfterUpdate. Below is the Code
for the Form_AfterUpdate. Any help is greatly appreciated
as always.
Thanks,
Gerard
--------------------------------------------------------
Private Sub Form_AfterUpdate()
Dim lngHomeID As Long
lngHomeID = Me.Homeid
Form.Recordset.MoveLast
Form.Recordset.MoveFirst
Form.Recordset.FindFirst ("[HomeID] = " & lngHomeID)
Form.Refresh
End Sub