I'm want to use either a hash table or a dictionary in my access program. Apparently, I'm supposed to be using the Microsoft Scripting Runtime Library for this, but it doesn't work.
我想在我的访问程序中使用哈希表或字典。显然,我应该使用Microsoft Scripting Runtime Library,但它不起作用。
Dim Dict1 As Dictionary
' Create a dictionary instance.
Set Dict1 = New Dictionary
It can't find the methods ".compareMode" or ".Add":
它找不到方法“.compareMode”或“.Add”:
With Dict1
'set compare mode
.CompareMode = BinaryCompare
' Add items to the dictionary.
.Add 1, "Item 1"
.Add 2, "Item 2"
.Add 3, "Item 3"
End With
Instead, these are the only one avaiable to me:
相反,这些是我唯一可以使用的:
.application
.creator
.delete
etc...
Any clues?
1 个解决方案
#1
Well, first of all change BinaryCompare to vbBinaryCompare.
好吧,首先将BinaryCompare更改为vbBinaryCompare。
And I think you want to be doing your set like this:
我想你想要像这样做你的套装:
Set Dict1 = CreateObject(Scripting.Dictionary)
Edit Just so that it is more visible, here is Anton's eventual solution. He changed the way he declared his dictionary as follows:
编辑只是为了让它更加明显,这是Anton的最终解决方案。他改变了他宣布字典的方式如下:
Dim SortValues As Scripting.Dictionary
Set SortValues = New Scripting.Dictionary
#1
Well, first of all change BinaryCompare to vbBinaryCompare.
好吧,首先将BinaryCompare更改为vbBinaryCompare。
And I think you want to be doing your set like this:
我想你想要像这样做你的套装:
Set Dict1 = CreateObject(Scripting.Dictionary)
Edit Just so that it is more visible, here is Anton's eventual solution. He changed the way he declared his dictionary as follows:
编辑只是为了让它更加明显,这是Anton的最终解决方案。他改变了他宣布字典的方式如下:
Dim SortValues As Scripting.Dictionary
Set SortValues = New Scripting.Dictionary