retrieving length's of columns in a database?
I have an access database with a pair of tables. I know how many fields are in the table (42 and 36). I want to load, using an array, the field lengths of each field into an array. Why doesn't the following work? It gives me a -1 for each element in the array instead of the numeric length of the field. Here is what I have:
VB Code:
For i = 0 To 42
tcrhdrfldlen(i) = tcrhdrdt.Columns(i).MaxLength
Next i
For i = 0 To 36
tcrdtrfldlen(i) = tcrdtrdt.Columns(i).MaxLength
Next i
Here is what worked in VB5:
VB Code:
For i = 0 To 42
tcrhdrfldlen(i) = tcrhdrdt.Fields(i).Size
Next i
For i = 0 To 36
tcrdtrfldlen(i) = tcrdtrdt.Fields(i).Size
Next i
Thanks for the help!