Access 2013 - sample array code

My OS is win 7 prof 64 bit and I use Office 365.  i created a simple array in Access 2013, to see if it works, but I get the error "object does not support ..."  Hope the experts can point out where I went wrong from the attached code.  Thank u.
samplearraycode.txt
jegajothyretiredAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
MacroShadowConnect With a Mentor Commented:
btw, there is no need to loop thru the array twice. Try this:
Private Sub Command24_Click()

    Dim aintRandomNum(1 To 10) As Integer
    Dim intX As Integer

    Randomize

    For intX = 1 To 10
        ' load the "aintRandomNum" array with random numbers between 1 and 100 ...
        aintRandomNum(intX) = Int(100 * Rnd + 1)
        ' display the contents of the "aintRandomNum" array ...
        Debug.Print aintRandomNum(intX)
    Next

End Sub

Open in new window

0
 
MacroShadowCommented:
Change
Print aintRandomNum(intX)
To
Debug.Print aintRandomNum(intX)
0
 
Rgonzo1971Commented:
Hi,

shouldnt'be

Debug.Print


Regards
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
Gustav BrockCIOCommented:
All you need is:

Debug.Print aintRandomNum(intX)

/gustav
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Or use

Msgbox aintRandonNum(intX)
0
 
jegajothyretiredAuthor Commented:
MacroShadow's code works, thank u.
0
 
jegajothyretiredAuthor Commented:
thank u for the solution. gracias
0
 
MacroShadowCommented:
De nada :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.