列表框中的隐藏列-Access 2007 [英] Hidden Column in Listbox - Access 2007

查看:68
本文介绍了列表框中的隐藏列-Access 2007的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access 2007中有一个链接到表的列表框.该表有4列,但我在列表框中只有2列可见.我使用loop命令来标识选定的行,但是我只能查看可见列的内容.找到后会显示可见列,因此至少我知道我有正确的行.我相信其他2个隐藏的列在技术上对我来说是可用的,因为当我查看与列表框关联的SQL时,我看到了它们被引用.所以我有2个相关问题:

I have a listbox in Access 2007 that is linked to a table. That table has 4 columns but I only have 2 of those columns visible in the listbox. I use the loop command to identify the selected row but I can only view the contents of the visible columns. I display the visible column when I find it so at least I know I have the right row. It is my belief that the other 2 hidden columns are technically available to me because I see them referenced when I view the SQL associated to the listbox. So I have 2 related questions:

  1. 我如何确认那2个隐藏的列实际上对我可用?以及如何访问它们(我想获取与所选行关联的主键.)

  1. How can I confirm that those 2 hidden columns are actually available to me? And how can I access them (I want to get the primary key associated to the row selected.)

如果这些隐藏的列可用,并且我想在列表框中显示它们,我该怎么做?

If those hidden columns are available and I wanted to make them visible in the listbox, how would I do that?

Learning Access现在是周末的爱好.在此先感谢您.戴夫L

Learning Access is now a weekend hobby.Thanks in advance. DaveL

推荐答案

您可以使列表框显示您想要的任何内容.在设计视图中选择它后,请打开属性表并选择格式"选项卡.它说列数和列宽的地方是您可以修改显而易见的地方.通过属性表上的数据"标签,您可以选择要在列表框中显示的所有4个字段.

You can make a listbox show whatever you would like. When you have it selected in design view then open the property sheet and select the Format tab. Where it says column count and column widths is where you can modify the obvious. The Data tab on the property sheet will allow you to select all 4 of your fields to appear in the listbox.

现在要使用该列表框中的数据,可以将VBA用于click(),如果您具有与该列表框关联的主键,则可以选择要使用的列.

Now to use the data in that listbox, you can use the VBA for click() and choose which column you want to work with if you have the primary key associated with that listbox.

Public Sub The_Listbox_Click()

Dim myR as Recordset

Set myR = CurrentDb.OpenRecordset("Table_Name", dbOpenDynaset)

myR.FindFirst ("[Primary_Key_Field] = '" & Me.The_Listbox.Column(0) & "'")

'You can now use that record with myR![Field_Name]

Set myR = Nothing

End Sub

这篇关于列表框中的隐藏列-Access 2007的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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