Solved

Access 2013 - sample array code

Posted on 2015-02-05
8
482 Views
Last Modified: 2015-02-05
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
0
Comment
Question by:jegajothy
8 Comments
 
LVL 26

Expert Comment

by:MacroShadow
ID: 40591181
Change
Print aintRandomNum(intX)
To
Debug.Print aintRandomNum(intX)
0
 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 40591184
Hi,

shouldnt'be

Debug.Print


Regards
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40591185
All you need is:

Debug.Print aintRandomNum(intX)

/gustav
0
 
LVL 84
ID: 40591186
Or use

Msgbox aintRandonNum(intX)
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 26

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 40591198
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
 

Author Comment

by:jegajothy
ID: 40591551
MacroShadow's code works, thank u.
0
 

Author Closing Comment

by:jegajothy
ID: 40591552
thank u for the solution. gracias
0
 
LVL 26

Expert Comment

by:MacroShadow
ID: 40592387
De nada :-)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now