列表框显示 table 的列名称
Listbox show column names of table
我正在尝试获取一个列表框来显示特定 table 中可用的所有列(字段)的列表。现在下面的代码实现了这一点,但使用了一个 msgbox 来显示我不想要的每个字段。
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("YourTableName")
For Each fld In rst.Fields
MsgBox fld.Name
Next fld
rst.Close
Set rst = Nothing
Set fld = Nothing
基本上我想要一个组合或列表框来显示来自特定 table 的所有字段 - 这可能吗?
你自己太难了。
在列表框的 属性 窗格中,设置:
RowSource: YourTableName
RowSourceType: Field List
我正在尝试获取一个列表框来显示特定 table 中可用的所有列(字段)的列表。现在下面的代码实现了这一点,但使用了一个 msgbox 来显示我不想要的每个字段。
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("YourTableName")
For Each fld In rst.Fields
MsgBox fld.Name
Next fld
rst.Close
Set rst = Nothing
Set fld = Nothing
基本上我想要一个组合或列表框来显示来自特定 table 的所有字段 - 这可能吗?
你自己太难了。
在列表框的 属性 窗格中,设置:
RowSource: YourTableName
RowSourceType: Field List