[AccessD] Keeping place after requerying

Bruce Bruen bbruen at bigpond.com
Thu Jun 19 03:29:09 CDT 2003


Ooops, I forgot!

If more than one person is deleting records then this will not work!

Bruce

-----Original Message-----
From: Bruce Bruen [mailto:bbruen at bigpond.com] 
Sent: Thursday, June 19, 2003 6:27 PM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] Keeping place after requerying


Presumably you are using A2K, where I have just had the same problem.
It happens if the continuous form is bound to a stored query for me. I
have saved the form filter setting, the order by and the
AbsolutePosition. I can then restore the form record focus by y
reapplying the saved filter and orderby, then moving to the stored
position + 1, making an allowance for the case of deleting the last row
in the recordset.  See if the following helps.

    rk = Me.Recordset.AbsolutePosition
    so = Me.OrderBy
    oo = Me.OrderByOn
    flt = Me.Filter

    If DeleteRow(Me!fldID) Then
        Me.Requery
        Me.Filter = flt
        Me.OrderBy = so
        Me.OrderByOn = oo
        If rk + 1 > Me.Recordset.RecordCount Then
            rk = Me.Recordset.RecordCount
        Else
            rk = rk + 1
        End If
        
        DoCmd.GoToRecord , , acGoTo, rk
   endif


Hth
Bruce

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Thursday, June 19, 2003 5:27 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Keeping place after requerying


Hi Selina

> I understandably annoyed customer because everytime they delete
> something from their very long list and the data is requeried (via 
> code), they end up at the top of their list again and have to scroll 
> down. Can anyone please help in how I keep the focus on the next 
> record to the one they have just deleted?

Why do you requery the form? That shouldn't be necessary - except for an
unbound form ...

/gustav

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list