MS Access 2003 - 自动显示表单列表框中的最后一条记录而不是第一个记录

发布于 2024-08-23 06:35:08 字数 244 浏览 6 评论 0原文

所以我有一个表单,其中有一个像分类帐一样显示的列表框。我的问题是如何让它显示最后一条记录(或者将滚动条默认显示在底部而不是顶部),而不是默认显示前几条记录。

现在我的意思并不是从下到上而不是从上到下反转顺序(尽管学习如何做这将是一件很酷的事情),只是简单地显示列表的底部(就滚动条而言)和默认值,以便它始终显示最后 10 条左右的记录(基于我制作列表框的大小)。

所以我认为这很简单,但话又说回来,我显然不知道?!?!

谢谢!

So I have a form that has a listbox that shows like a ledger. My question is how can I make it display the last records (or have the scroll bar default to the bottom instead of the top), instead of the first few as the default.

Now I don't mean reversing the order from bottom to top instead of top to bottom (though that would be a cool thing to learn how to do), just simply having the bottom of the list (in terms of the scroll bar) shown and the default, so that it is always showing the last 10 or so records (based on the size that I made the list box).

So i think this is simple, but then again, I obviously do not know?!?!

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

隔岸观火 2024-08-30 06:35:08

在合适的事件中,例如当前事件:

 Me.ListX.Selected(Me.ListX.ListCount - 1) = True

In a suitable event, such as the current event:

 Me.ListX.Selected(Me.ListX.ListCount - 1) = True
玩心态 2024-08-30 06:35:08

您可以向表单加载事件添加一些代码,以便它执行以下操作:

YourListBox.SetFocus
YourListBox.ListIndex = YourListBox.ListCount - 1
YourListBox.Selected(YourListBox.ListCount - 1) = False

它基本上选择列表框中的最后一项,以便向下滚动到它,然后取消选择它。

You could add some code to the form load event so that it will do this:

YourListBox.SetFocus
YourListBox.ListIndex = YourListBox.ListCount - 1
YourListBox.Selected(YourListBox.ListCount - 1) = False

It basically selects the last item in the list box so it will scroll down to it, and then unselects it.

甲如呢乙后呢 2024-08-30 06:35:08

我知道这是稍后的事,但也许这会对将来遇到此线程的人有所帮助。这是我用来转到最后一条记录然后取消选择最后一条记录的代码。

 YourListBox.SetFocus
 YourListBox.Selected(YourListBox.ListCount - 1) = True
 YourListBox.Selected(YourListBox.ListCount - 1) = False

I know this is later but maybe this will help someone in the future who comes upon this thread. This is the code I used to go to the last record then unselect the last record.

 YourListBox.SetFocus
 YourListBox.Selected(YourListBox.ListCount - 1) = True
 YourListBox.Selected(YourListBox.ListCount - 1) = False
染柒℉ 2024-08-30 06:35:08

你是如何设置列表框项目的?它们来自数据库吗?如果是,那么您需要使用“order by columnName”更新 SQL 语句。

How did you set the listbox items? Are they from a database? If yes, then you need to update the SQL statement with an "order by columnName".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文