Requery and reposition

A

Andi Mayer

Hi all

I use a lot of requeries and the the usual
Me.Bookmark=Me.recordset.bookmark

It works fine, but one tinny litle think I don't like.

the choosen record in a Continuous Form
jumps to the top position.

Is it posibly to find out (bevor the requery) at which position (the
row on the screen) the active record was and after the requery "move"
this record to same position (if posible)


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
S

stefan hoffmann

hi Andi,

Andi said:
Me.Bookmark=Me.recordset.bookmark
Is it posibly to find out (bevor the requery) at which position (the
row on the screen) the active record was and after the requery "move"
this record to same position (if posible)

If your underlying table has a PK, you can use

With Me.RecordsetClone
.FindFirst "YourPK = " & PKValue
Me.Bookmark = .Bookmark
End With

to jump to the old record.

mfG
--> stefan <--
 
A

Andi Mayer

As you see this is not my problem, the problem is:
I don't want that the active record is on top, it should be (for
example) on the fifth line as it was bevor the rquery.

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
A

Andi Mayer

On Fri, 26 Nov 2004 11:31:33 +0100, stefan hoffmann


BTW: this is dangerous!!
you should add: if .not noMatch then Me.boo.....

if the PKValue doesn't exist anymore, due to changes in the
recordsource you will get a runtime error

BTW2: if you use the Recordset ( I think not posible in 97) you can
spare the Me.book....
With Me.RecordsetClone
.FindFirst "YourPK = " & PKValue
Me.Bookmark = .Bookmark
End With

to jump to the old record.

mfG
--> stefan <--

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
S

stefan hoffmann

hi Andi,

Andi said:
BTW: this is dangerous!!
you should add: if .not noMatch then Me.boo.....
if the PKValue doesn't exist anymore, due to changes in the
recordsource you will get a runtime error

Keep it simple .) On Local Error Resume Next. This is not really a life
threatening functionality.

mfG
--> stefan <--
 
S

Stephen Lebans

See the SelTop sample Form here:
http://www.lebans.com/setgetsb.htm
SetGetSB.zip is a database containing functions to allow a user to Set
or Get the current position of a ScrollBar Thumb for a Form.

NEW - Apr. 02/2000 The current ScrollBar position is equal to the
current Record Number being displayed at the Top of the Form.

Works in Form or Datasheet view.

Ver 1.7

Fix bug in SelTop method. Now works with first page of rows properly and
sets the Top row correctly when moving forward in the recordset one row
at a time.

Ver 1.6

Use SelTop to save Restore current row's position after a Requery.

Ver 1.5

Added support for Horizontal ScrollBars.


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andi Mayer said:
As you see this is not my problem, the problem is:
I don't want that the active record is on top, it should be (for
example) on the fifth line as it was bevor the rquery.

If you expect an answer to a personal mail, add the word "manfred" to
the first 10 lines in the message
 
A

Andi Mayer

See the SelTop sample Form here:
http://www.lebans.com/setgetsb.htm
SetGetSB.zip is a database containing functions to allow a user to Set
or Get the current position of a ScrollBar Thumb for a Form.

Thanks for the Hint

Your Program was very usefull to get the idee behind SelTop.

I wrote a class with a requery .

If somebody is interested I could post it here.

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top