gdev
Technical User
- Mar 12, 2001
- 38
I have the following code:
With tblXL
.Fields("0").OrdinalPosition = 0
.Fields("1").OrdinalPosition = 1
.Fields("2").OrdinalPosition = 2
.Fields("3").OrdinalPosition = 3
.Fields("4").OrdinalPosition = 4
.Fields("5").OrdinalPosition = 5
.Fields("6").OrdinalPosition = 6
.Fields("7").OrdinalPosition = 7
.Fields("8").OrdinalPosition = 8
.Fields.Refresh
End With
There are 12 fields in the table, 3 of which are dynamic because the date changes.
After running the code, field 8 is in position 9 and dynamic field 9 is in position 8. Sometimes the code runs perfectly, most of the time the field positions are in the wrong order. Table is automatically exported to Excel.
Table design after code runs.
table field ordinal position
field 0 0
field 1 1
field 2 2
field 3 3
field 4 4
field 5 5
field 6 6
field 7 7
field 8 9
dynamic field 9 8
dynamic field 10 10
dynamic field 11 11
Is there something I overlooked or how can I make this work?
With tblXL
.Fields("0").OrdinalPosition = 0
.Fields("1").OrdinalPosition = 1
.Fields("2").OrdinalPosition = 2
.Fields("3").OrdinalPosition = 3
.Fields("4").OrdinalPosition = 4
.Fields("5").OrdinalPosition = 5
.Fields("6").OrdinalPosition = 6
.Fields("7").OrdinalPosition = 7
.Fields("8").OrdinalPosition = 8
.Fields.Refresh
End With
There are 12 fields in the table, 3 of which are dynamic because the date changes.
After running the code, field 8 is in position 9 and dynamic field 9 is in position 8. Sometimes the code runs perfectly, most of the time the field positions are in the wrong order. Table is automatically exported to Excel.
Table design after code runs.
table field ordinal position
field 0 0
field 1 1
field 2 2
field 3 3
field 4 4
field 5 5
field 6 6
field 7 7
field 8 9
dynamic field 9 8
dynamic field 10 10
dynamic field 11 11
Is there something I overlooked or how can I make this work?