-Collapse +Expand

To/From Code

-Collapse +Expand Languages
-Collapse +Expand Categories
-Collapse +Expand Browse Language
   PrestwoodBoardsTo/From GuidesReferenceAccess VBAData Structures   

Access VBA Data Structures

Array

Languages Focus

A data structure in which individual values (called elements or items) may be located by reference to one or more integer index variables, the number of such indices being the number of dimensions in the array.

Arrays can start with an index value of 0 or 1, sometimes referred to as 0 based or 1 based.

Access VBA:   x = Array()

Arrays in Access VBA use a 0-based indice. Use UBound to get the number of elements. UBound returns -1 if the array has no elements, 0 if it has 1, 1 if it has 2, etc.

Syntax Example:
Dim MyArray As Variant
Dim i As Integer
 
MyArray = Array("Mike", "Lisa", "Felicia", "Nathan")
 
If UBound(MyArray) > -1 Then
  For i = 0 To UBound(MyArray)
    MsgBox (MyArray(i))
  Next
End If


Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.

Intermediate

1 Intermediate Level Question

Question #1: True or False?

Arrays in Access VBA are 0 based.

Answer:
  • True
  • False
  • More Info

     





    Sponsored Ad
    Brought to you by Prestwood IT Solutions,  Content by Mike Prestwood (owner of Prestwood IT Solutions)

    We hope you are enjoying Mike's cross reference language encyclopedia! Our company is the caretaker of PrestwoodBoards.com where we pay our staff to moderate, edit, and participate. Why? Online participation is fun, we enjoy sharing information, and this is our way of promoting our I.T. services company.

    We provide coding, website, and computer tech services. Keep us in mind if you or your company needs help.

    Talented Developer?
    If you are a talented developer and would like to work with us, start by filling out our Register for Work form.
     
    715 People Online Now!!  
    Online Now: Sign In to see who's online now!  Not a member? Join Prestwood now. It's free!