How do I display array contents to user?

glenn69

New member
Local time
Today, 06:55
Joined
Dec 8, 2004
Messages
7
I am using an inputbox( ) to accept job numbers to include in a particular process in a database. Each Inputbox( ) value is inserted into an array. After the user enters the last value, I would like to display a list of all of the values entered so that the user can confirm. The list does not need special formatting, simply a list of numbers.

How do I display the values in the array to the user ?

Thanks
 
Code:
' Build array just for the example.
Dim myArray(3) As String
myArray(0) = "Hi there"
myArray(1) = "Smith"
myArray(2) = "John"

' Concatenate into a string.
Dim message As String
message = "Greeting = " & myArray(0) & vbCrLf & _
          "Last Name = " & myArray(1) & vbCrLf & _
          "First Name = " & myArray(2)
          
' Show it.
If MsgBox(message, vbOKCancel, "Please confirm!") = vbOK Then
  ' Do this.
Else
  ' Do that.
End If

Regards,
Tim
 
You can also loop through an array like this....

Code:
    ReDim sMyArray(10) As String
    Dim sTemp As String
    Dim k As Integer
    
    Randomize
    
    For k = 0 To UBound(sMyArray)
        sMyArray(k) = Trim(Str(CInt(Rnd * k + 1)))
    Next
    
    For k = 0 To UBound(sMyArray)
        sTemp = sTemp & sMyArray(k) & " - "
    Next
    
    MsgBox sTemp
 

Users who are viewing this thread

Back
Top Bottom