Avatar of peispud
Flag for Canada asked on

Two dimensional array of a type structure in access vba


I am using  Access 2010

I would like to create a two dimensional array.    (I actually think that I am asking for a two dimensional array of a "type structure". )
The first element would be an integer. The second would be a string

myarray(0,0) = 1
 myarray(0,1) = "test"            ... etc

Thank you
Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon

You can use variant datatype in these case..
Dim A As Variant
A = 10,"Twenty", 30
B = A(2)
Dale Fye

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

I am hoping to not use variants.

When I put in the code below,  Access produces an error when I try to load the form

Option Compare Database
Option Explicit

Public Type myType
    myNum As Integer
    myStr As String
End Type
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Everything became perfect after I moved the type declaration to a code module.

Thank you very much!  This was some "just on time" help.
Dale Fye

glad to be of service.