我可以在数据表视图中确定滚动条的位置吗? [英] Can I determine the position of the scroll bar in datasheet view?

查看:62
本文介绍了我可以在数据表视图中确定滚动条的位置吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据表视图中显示的表单,我有一些操作需要使用删除操作来重新获取该表单,但是在此特定情况下,数据表视图中的行数保持不变,并执行删除操作。 />

我试图将用户返回到他刚刚选择动作的同一行,并且也在屏幕上的相同位置 - 即同一行和相同的位置滚动条。


例如:


数据表有100条记录(行)


用户是目前查看记录45-60(滚动条大约是一半)


用户为动作选择记录56.


动作结束,记录被重新检查以反映变化(我到目前为止无法复制这个没有重新查询)


我能够将用户返回到记录56,但它是现在位于窗口的底部,而不是它的大约一半被选中了。我也可以弄清楚如何让它在列表的顶部,但我希望它返回相同的位置。


任何人都知道如何做到这一点?


提前致谢!

I have a form shown in datasheet view, and I have some actions that require that form to be requeried with a delete operation, however number of rows in the datasheet view remains constant with a delete operation in this specific case.

I am trying to return the user back to the same row that he just selected the action on, and also at the same position on the screen - i.e. the same row and the same position of the scrollbar.

An example:

datasheet has 100 records (rows)

User is currently viewing records 45-60 (scrollbar is approximately half way down)

The user selects record 56 for the action.

The action finishes, the records are requeried to reflect the change (I have so far been unable to replicate this without the requery)

I am able to return the user to the record 56, but it is located at the bottom of the window now, not about halfway up as it was when it was selected. I also can figure out how to get it to be at the top of the list, but I want it to return the same position.

Anyone have any idea how to do this?

Thanks in advance!

推荐答案

对不起忘了提及 - Access 2003
Sorry forgot to mention - Access 2003



对不起忘了提及 - Access 2003
Sorry forgot to mention - Access 2003



查看Bookmark属性。


如果您将书签设置为当前记录编号,执行删除操作然后将书签重置为相同的编号,您实际上已经保留到位。

实验还包括刷新和重新查询。


J

Look into the Bookmark property.

if you set the bookmark at the current record number, do your delete action then reset the bookmark to that same number, you have effectively remained in place.

experiment also with refresh vs requery.

J



查看书签属性。


如果您将书签设置为当前记录编号,执行删除操作然后将书签重置为相同的编号,您实际上已经保留到位。

实验还包括刷新和重新查询。


J
Look into the Bookmark property.

if you set the bookmark at the current record number, do your delete action then reset the bookmark to that same number, you have effectively remained in place.

experiment also with refresh vs requery.

J



我目前正在使用书签返回正确的号码。正如我所提到的,问题不在于返回正确的记录。问题是,当我返回到该记录时,它与操作前的行不同。


我确实尝试使用刷新后你的建议取得了一些成功,但是这导致了一些奇怪的行为,我可以绕过但是如果我能弄清楚滚动条位置,那么requery肯定会更好。


也许我不清楚,所以让我们我再试一次,

我有一个返回100条记录的查询。

在数据表视图中(这是一个子表单,因此查看区域有限)有大约的空间。一次只能看到25条记录。

因此,要查看第57行中的记录,用户必须通过某种机制向下滚动到该记录。无论如何,滚动条确实前进,以反映当前看到的25条记录来自总共100条记录的哪一部分。


如果我们假设用户使用鼠标向下滚动到记录57,可以安全地假设用户不可能滚动,直到记录57正好是可视区域的第25行中的记录。例如,假设在向下滚动之后视图中的记录是记录51到75.因此在行1中是记录51而在行25中是记录75.要改变的记录是#57,在行7中。


编辑完成后 - (仅在一个特定情况下,不仅仅是任何编辑,但我必须处理这种特殊情况),调用重新查询。


如果我保存书签并返回到同一记录,或者保存selTop并重置它(对两者都有相同的效果)。在重新查询并重置位置之后,我留下:

用户正在查看记录33到57,编辑记录现在在第25行。

我想要什么要完成的是在requery重新建立滚动条的状态而不仅仅是记录编号。因此,在重新查询之后,用户仍然在查看记录51-75,并且编辑的记录仍然位于第7行。


据我所知,书签属性不会解决这个问题,我错过了什么吗?


是否真的无法找出视图中的哪些记录,或滚动条位置的某些指示?

I am currently using the bookmark to return the correct number. As I mentioned the problem is not in returning the the correct record. The problem is that when I return to that record it is not in the same row as it was before the operation.

I did try to use refresh after your suggestion with some success, but that resulted in some bizarre behavior that I can maybe get around but requery most certainly works better if I can figure out the scroll bar position.

Perhaps I wasn''t clear, so let me try again,
I have a query that returns 100 records.
In the datasheet view (it''s a subform so viewing area is limited) there is room for approx. 25 records to be seen at a time.
Therefore to see the record in row 57 the user must scroll down to it by some mechanism. However that is done the scroll bar does advance to reflect which portion of the total 100 records the currently seen 25 records are from.

If we assume the user uses the mouse to scroll down to record 57, its safe to assume it unlikely the user will scroll until record 57 is exactly the record in the 25th row of the viewable area. For the sake of example, lets say the records in view after the scroll down are records 51 through 75. So in row 1 is record 51 and in row 25 is record 75. The record to be changed is #57 which is in row 7.

After the edits are made - (it''s only in one specific case, not just any edit, but I must handle this special case as well), a requery is called.

If I save a bookmark and return to the same record, or by saving the selTop and resetting it (same effect for both). After the requery and reset of position I am left with:
The user is viewing records 33 through 57, with the editied record now in row 25.
What I am wishing to accomplish is after the requery reestablish the state of the scrollbar not just the recordnumber. So after the requery the user is still viewing records 51-75 and the edited record is still located in row7.

As far as I am aware the bookmark property isn''t going to solve this one, am I missing something?

Is there really no way to find out which records are in view, or some indication of the position of the scrollbar?


这篇关于我可以在数据表视图中确定滚动条的位置吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆