I am trying to make a program of a telephone which has an add to memory and a memory recall button that stores 10 names and numbers and then displays them, if for example I press Memory 1.  I can get the program to add to memory, but if I add more than one record I can't get the display to show the name and number. I don't really know much about arrays.  Where have I gone wrong with the programming?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

"My program won't work. What's wrong?".. I don't think noone can help you much here, because you do not show anything of the code you use now. If you want I can have a look to see what the problem is (my email is

One reason for the problem you have can be that you redim a array with ReDim when you should use ReDim Preserve (look in the help file if you do not know what Preserve means).
Here is an example of how you can store 10 names and numbers in an array, then retrieve them...

1) Create a new project.

2) Add 2 command buttons to the project.

3) Add a MODULE to the project and add the following code to the module:

   Public PhoneMemory(1 To 10, 1 To 2) As String

4) Add the following code to the DECLARATION SECTION of Form1:

    Private Sub Command1_Click()
        'Load Name and Numbers
        PhoneMemory(1, 1) = "Marvin"
        PhoneMemory(1, 2) = "555-1111"
        PhoneMemory(2, 1) = "Steve"
        PhoneMemory(2, 2) = "555-2222"
        PhoneMemory(3, 1) = "Mary"
        PhoneMemory(3, 2) = "555-3333"
        PhoneMemory(4, 1) = "Jessie"
        PhoneMemory(4, 2) = "555-4444"
        PhoneMemory(5, 1) = "Allen"
        PhoneMemory(5, 2) = "555-5555"
        PhoneMemory(6, 1) = "Betsy"
        PhoneMemory(6, 2) = "555-6666"
        PhoneMemory(7, 1) = "Hal"
        PhoneMemory(7, 2) = "555-7777"
        PhoneMemory(8, 1) = "Mickey"
        PhoneMemory(8, 2) = "555-8888"
        PhoneMemory(9, 1) = "Birdie"
        PhoneMemory(9, 2) = "555-9999"
        PhoneMemory(10, 1) = "David"
        PhoneMemory(10, 2) = "555-0000"
    End Sub
    Private Sub Command2_Click()
        'Display all of the stored numbers to the debug window
        Dim iVal As Integer
        For iVal = 1 To 10
            Debug.Print "Stored Name #" & iVal & ": " & PhoneMemory(iVal, 1)
            Debug.Print "Phone #" & iVal & ": " & PhoneMemory(iVal, 2)
            Debug.Print " "
        Next iVal
    End Sub

5) Run the program.

6) Click Command1 to load the names & numbers.

7) Click Command2 to show the loaded names and numbers in the debug window.

Hope this helps!



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BoonAuthor Commented:
Thank you so much.
Glad I could help! Thanks for the points!


You still have a duplicate of this question open at 

If you want your 100 points back, go delete this question...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.