Hello,
I've got this code:
I still get the error subscript out of range (error 9). In the help file there is this:
Dim MyArray() As Integer
MyArray(8) = 234 ' Causes Error 9.
This is because I've declared an array without a dimension (i think
)
How to declare a array without knowing how much elements will eventually be in it?
Thanks in advance
I've got this code:
Code:
Dim FieldNames() As String
Dim Rst As Recordset
Dim f As Field
Dim Counter As Integer
Set Rst = CurrentDb.OpenRecordset("TblParts")
Counter = 0
For Each f In Rst.Fields
FieldNames(Counter) = f.Name
Counter = Counter + 1
Next
Rst.Close
ReDim Preserve FieldNames(Counter)
Dim MyArray() As Integer
MyArray(8) = 234 ' Causes Error 9.
This is because I've declared an array without a dimension (i think

How to declare a array without knowing how much elements will eventually be in it?
Thanks in advance
