English 中文(简体)
3. 利用2000年上网收集的钥匙的回归价值
原标题:Retrieve Value Using Key From a Collection in Access 2000

我知道这是一个简单的问题,但它使我更加严重。 如果在收集中我有关键/价值,但我似乎无法利用钥匙获得价值。 我可以拿到钥匙,使用价值,但不是用价值。 是否有某种魔法来实现这一目标?

例如:

Dim CycleList As Collection
Dim Value as String
Set CycleList = New Collection
CycleList.Add 1, "Some Value"


Value = CycleList(1)

我也尝试过周期性语言。 项目(1)及其结果相同,价值=1。

最佳回答

原因是,你将VBA加起来,在收集中添加一个包含<编码>Some Value的备选关键词。 当您打电话CycleList(1)时,请上。 项目1: 1. 导言 第二个参数<代码>Some Value是你可以用来找到你想要的项目的备选关键。 例如:

Public Sub Foo()
    Dim bar As Collection
    Set bar = New Collection
    bar.Add 1, "Blah"
    bar.Add "Foobar"
    bar.Add 99

    Debug.Print "bar(""Blah""): " & bar("Blah")
    Debug.Print "bar(1): " & bar(1)
    Debug.Print "bar(2): " & bar(2)
    Debug.Print "bar(3): " & bar(3)
End Sub

• de在 de窗中:

bar("Blah"): 1
bar(1): 1
bar(2): Foobar
bar(3): 99

注 印刷,我要求钥匙的价值,但在其他人中,我要求按指数计算价值。

问题回答

暂无回答




相关问题
Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Outlook 2007 CommandBarControl.Execute won t work

I recently switched to Outlook 2007 and noticed that my VBA-macros won t work. I use the following code to open a new appointment-item (and fill it automatically). It worked perfect in Outlook 2003, ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

MS Access: list macro from VBA

I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by ...

热门标签