VBA-tools / VBA-Dictionary

Drop-in replacement for Scripting.Dictionary on Mac
MIT License
348 stars 89 forks source link

second dictionary object is empty. #37

Open hammrxu opened 2 years ago

hammrxu commented 2 years ago

I have two dictoinary object, mydict and mydict2. I have customer email and customer address to store, mydict stores email as key, address as value. mydict2 store address as key, email as value when mydict.exist(a record). I look at locals window. the records are well store inside mydict and mydict2. and it is accessible for mydict, but not for mydict2.

when i debug mydict with debug.print


   Debug.Print "email : " & mydict2(Key)
   Debug.Print "address : " & Key
next key```

output:
```email : 
address : ```
hammrxu commented 2 years ago

i write two objects inside one subroutine

Nick-vanGemeren commented 2 years ago

Your second Print shows thatKeyis blank or empty. So no surprise that there is no email.

The Locals window will only show you keys. You can use VBA-JSON to get a dump of your dictionaries:

   Debug.Print "mydict : ";  JsonConverter.ConvertToJson(mydict,2)

Some of your posted code may have been lost: 3-backticks should be on their own line. Please post the creation and debugging code.

If you have already solved your problem, please close this issue.