0

Is it possible to create a constant two dimensional array in VBA using access only? I have Tried:

Const s1 As String = [{"a","b","c";"1","2","3"}]

from How to initialize a multidimensional array variable in vba for excel and

Const s2 as variant = array(array("a","b","c"),array("1","2","3"))

But neither work. I checked to see if they work as regular declarations.

Dim s1 As String = [{"a","b","c";"1","2","3"}]

fails, and it seems to be because i am not using Excel.

dim s2 as variant = array(array("a","b","c"),array("1","2","3")) 

succeeds.

braX
  • 11,506
  • 5
  • 20
  • 33
KySoto
  • 399
  • 2
  • 7
  • VBA doesn't let you assign a value on the `Dim` line like `vb.net` does. First you `Dim` it, then you assign the values on a second line. – braX Apr 17 '18 at 18:52
  • Ah dang, i didn't notice that one because i was looking for two dimensional arrays in my query. – KySoto Apr 17 '18 at 18:55
  • this is not an exactly duplicate, because it ms-access and not excel-vba I have a solution for the excel-vba question. voted to re-open. – S Meaden Apr 17 '18 at 22:39

0 Answers0