Hi
I wonder if someone can help me I have coded a module and cannot work out why I am getting a out of range error can anyone help, here i my code:
************************module*********************
Option Explicit
Private m_arrOrders() As Variant
Private m_myID As Long
Private m_theirID As Long
Private m_nextID
Private m_incrament As Integer
Function Get_Set_NewOrderID(ByVal Mirror As Variant) As Long
Dim iTemp As Integer
If m_theirID < m_myID Then
m_nextID = m_myID
m_myID = m_myID + m_incrament
Else
m_myID = m_theirID - 1 + m_incrament
m_nextID = m_myID
m_myID = m_myID + m_incrament
End If
m_arrOrders(0, UBound(m_arrOrders, 2)) = m_nextID
For iTemp = 1 To UBound(m_arrOrders)
m_arrOrders(iTemp, UBound(m_arrOrders, 2)) = Mirror(iTemp)
Next iTemp
ReDim Preserve m_arrOrders(12, UBound(m_arrOrders, 2) +1)
Call DisplayArray
Get_Set_NewOrderID = m_nextID
End Function
The error is on this line:
m_arrOrders(0, UBound(m_arrOrders, 2)) = m_nextID
Thanks for any help
Scouseman
I wonder if someone can help me I have coded a module and cannot work out why I am getting a out of range error can anyone help, here i my code:
************************module*********************
Option Explicit
Private m_arrOrders() As Variant
Private m_myID As Long
Private m_theirID As Long
Private m_nextID
Private m_incrament As Integer
Function Get_Set_NewOrderID(ByVal Mirror As Variant) As Long
Dim iTemp As Integer
If m_theirID < m_myID Then
m_nextID = m_myID
m_myID = m_myID + m_incrament
Else
m_myID = m_theirID - 1 + m_incrament
m_nextID = m_myID
m_myID = m_myID + m_incrament
End If
m_arrOrders(0, UBound(m_arrOrders, 2)) = m_nextID
For iTemp = 1 To UBound(m_arrOrders)
m_arrOrders(iTemp, UBound(m_arrOrders, 2)) = Mirror(iTemp)
Next iTemp
ReDim Preserve m_arrOrders(12, UBound(m_arrOrders, 2) +1)
Call DisplayArray
Get_Set_NewOrderID = m_nextID
End Function
The error is on this line:
m_arrOrders(0, UBound(m_arrOrders, 2)) = m_nextID
Thanks for any help
Scouseman