使用行源将ListBox排序为表 [英] Sort ListBox with Row Source as Table

查看:102
本文介绍了使用行源将ListBox排序为表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用代码将文本框与Access 2007表单中的列表框同步。 这需要在vba中使用seek功能,该功能只能与与列表框关联的表一起使用。 我已将记录添加到列表框
中使用的表中,因此列表框的内容不再有序。 如何在不更改要查询的列表框的行源的情况下对此列表框进行排序?这可以通过vba完成吗?

I am using code to synchronize a textbox with a list box in an Access 2007 form.  This requires using the seek function in vba which can only be used with the table associated with the listbox.  I have added records to the table used in the listbox so the contents of the listbox is no longer in order.  How can i sort this listbox without changing the row source of the listbox to query? Can this be done through vba?

推荐答案

最简单的方法是创建一个记录集读取表(但在你想要的字段上排序并添加每个记录到列表框。这当然打破了与表格的联系。链接到视图更容易。
Simplest is to create a recordset reading teh table (but sorted on the field you want and add each record to the listbox. This of course breaks the link with teh table. Linking to a View is easier still.


这篇关于使用行源将ListBox排序为表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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