OK, I've been looking around and I've figured out at least one issue: I was trying to create a Collection of custom objects without defining the custom objects first (in other words, I didn't define my class!)
So my modified code now looks like this:
Class code - tSortItem
Code:
Option Compare Database
Option Explicit
Public Enum tSortType
tSortAsc = 1
tSortDesc = 2
[_First] = 1
[_Last] = 2
End Enum
Public tIndex As Long
Public tFieldName As String
Public tName As String
Public tSortOrder As tSortType
' FieldName is read/writeable
Property Get FieldName() As String
FieldName = tFieldName
End Property
Property Let FieldName(Value As String)
tFieldName = Value
End Property
' Index is read/writeable
Property Get Index() As Long
Index = tIndex
End Property
Property Let Index(Value As Long)
tIndex = Value
End Property
' Name is read/writeable
Property Get Name() As String
Name = tName
End Property
Property Let Name(Value As String)
tName = Value
End Property
' SortOrder is read/writeable
Property Get SortOrder() As tSortType
SortOrder = tSortOrder
End Property
Property Let SortOrder(Value As tSortType)
tSortOrder = Value
End Property
Collection Code - tSortList
Code:
Option Compare Database
Option Explicit
Private tName As String
Private tCount As Long
Private tSortList As Collection
Private tmpSortItem As tSortItem
' Name is read/writeable
Property Get Name()
Name = tName
End Property
Property Let Name(Value)
tName = Value
End Property
' Count is read-only!
Property Get Count()
Count = tCount
End Property
Public Sub Class_Initialize()
Set tSortList = New Collection
End Sub
While it still has problems (for one thing, there's still no way to properly handle changing indexes), that all will come later. What I'm looking for now is: How do I write my Collection's Add Sub?