Multidimentional const ???

ksor

Registered User.
Local time
Yesterday, 18:33
Joined
Feb 8, 2018
Messages
70
I would like to declare a multidimensional const of 11 pairs of 2 strings, but oh it hurt to find out how !


I can get this to work:


Dim MainFolders As String
MainFolders = [{"BILLEDE","IMG_files"; "BO_KOMMENTAR","BO_docs"; "DELTOG_I","GUEST_docs"; "GENST_KOMMENTAR","GENST_docs"; "NOTATER","NOTAT_docs"; "PARFORHOLD","PARF_docs"; "PERSONKOMMENTAR","PERS_docs"; "STED","KMZ_files"; "STED_Beskrivelse","STED_docs"}]



but it's NOT a const and a complete mess to look at !


Why does the normal split line sign ( space+underscore) NOT work here ?
How to do the declaring as a Const ?


2 questions = 2 answers ;-))
 
Why not a table?

TblXXX
id
fld1
fld2

where records are like
id contains 1
fld1 contains "BILLEDE"
fld2 contains "IMG_files"

record 2
id contains 2
fld1 contains "BO_KOMMENTAR"
fld2 contains "BO_docs"

etc...
 
Bacause I want it as a const
 
VBA constants are simple scalars. It doesn't do multidimensional constants. Arrays and recordsets can do the same job though.

Variables are constants for a long as you don't change them.;)
 
Not a constant, but I would load into a dictionary object because the first item looks like a key and the second a description. That way you can reference by key.
 
ksor,

Perhaps you could give us some details surrounding your request. It seems you're working with some format (??json??), but we know nothing of your requirements other than
Bacause I want it as a const
.

I suggest you focus on need, not want since the structure you're describing isn't native to Access.
 
I found out constants CAN'T be multidimensional, so I'll just have to have it as a global variable instead - and I HAVE that running :)


As with the other solutions I have to remember to initialize ... I thought I could shortcut here with a const ... but no :banghead:
 
Glad you have a solution.
 

Users who are viewing this thread

Back
Top Bottom