Access/VBA Library

Add Method

Adds an element to the array.

Syntax

array_.Add( Value [, Index] )
Parameters
Name Type Description
array_   The name of an object of type array_
Value Variant Required. Value to be added to the array.
Index Integer Optional. Position in the array to add the new element. When -1 the element is added to the end of the Array_.
Default: -1
Example
  Dim x As New Array_

  x.Add "Element one"
  x.Add "Element two"
  x.Add "Last element"
  x.Add "Element three", 3
  ' Result :
  'Array (
  ' [1] = > Element one
  ' [2] = > Element two
  ' [3] = > Element three
  ' [4] = > Last element
  ')