How to the last access record after a requery? (1 Viewer)

PuddinPie

Registered User.
Local time
Today, 05:13
Joined
Sep 15, 2010
Messages
149
I have a main form that is bassed off of a ticket number. When I access a different form and make changes to the ticket details and requery the main form to show the updated changes it always goes back to the first record. I would like it so that when it requerys the main form stays on the same ticket.
I was looking into a recordsetclone but can't find a go example to learn from and I've tryed forcing the ticket number into the field on the main form after the requery but that did not work either.
Any ideas???
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:13
Joined
Sep 12, 2006
Messages
15,651
i recently started to use this method

Code:
dim tmp as long

tmp = me.recordset.absoluteposition {save the position}

{do your processing stuff here}

me.requery { this puts the cursor back to record 1 - as you know}

me.recordset.absoluteposition = tmp {go back to the saved record number}
so this works fine, as long as you didnt change the number of records in the query. Otherwise there are some other ideas.
 

PuddinPie

Registered User.
Local time
Today, 05:13
Joined
Sep 15, 2010
Messages
149
Sorry but is this put in the main form or in the secondary for that is updating the record?
 

Dreamweaver

Well-known member
Local time
Today, 13:13
Joined
Nov 28, 2005
Messages
2,466
i recently started to use this method

Code:
dim tmp as long

tmp = me.recordset.absoluteposition {save the position}

{do your processing stuff here}

me.requery { this puts the cursor back to record 1 - as you know}

 me.recordset.absoluteposition = tmp {go back to the saved record number}
so this works fine, as long as you didnt change the number of records in the query. Otherwise there are some other ideas.


Hi found this today and gave it a try in a subform which on first try worked out well but as soon as i use it on same/subform form opened from another form it fails to work I have tried opening in different modes but no luck.


im using office 365


Anybody know of another way of moving back to the last record after a requery.
 

Dreamweaver

Well-known member
Local time
Today, 13:13
Joined
Nov 28, 2005
Messages
2,466
Had already tried the bookmark but tried yours but still wouldnt work


It might be down to the code as there is a lot happening in the after update event there's no requery as been though all the code but there is a run cmd save record which I tried removing and it didn't like it lol


thanks for the help
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:13
Joined
Aug 30, 2003
Messages
36,125
Can you attach the db here?
 

Dreamweaver

Well-known member
Local time
Today, 13:13
Joined
Nov 28, 2005
Messages
2,466
Can you attach the db here?


Sorry it's my project manager been trying to solve this one for as long as I can remember strange how it works if it's the only form open though


 

Attachments

  • 2018-12-06 (7).jpg
    2018-12-06 (7).jpg
    108 KB · Views: 225

Users who are viewing this thread

Top Bottom