Multidimentional const ??? (1 Viewer)

ksor

Registered User.
Local time
Today, 03:42
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 ;-))
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:42
Joined
Jan 23, 2006
Messages
15,379
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...
 

ksor

Registered User.
Local time
Today, 03:42
Joined
Feb 8, 2018
Messages
70
Bacause I want it as a const
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 20:42
Joined
Jan 20, 2009
Messages
12,851
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.;)
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:42
Joined
May 21, 2018
Messages
8,525
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.
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:42
Joined
Jan 23, 2006
Messages
15,379
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.
 

ksor

Registered User.
Local time
Today, 03:42
Joined
Feb 8, 2018
Messages
70
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:
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:42
Joined
Jan 23, 2006
Messages
15,379
Glad you have a solution.
 

Users who are viewing this thread

Top Bottom