zaphod3000
Programmer
I have a module which does some housekeeping on a number of tables.
At the moment, my code looks like this (this is just part of it)
For Counter = 1 To NoOfShipFlds
addFieldDescription ShipTable, ShipTableFlds(Counter, 1), ShipTableFlds(Counter, 2)
Next
For Counter = 1 To NoOfHBLsFlds
addFieldDescription HBLsTable, HBLsTableFlds(Counter, 1), HBLsTableFlds(Counter, 2)
Next
Whilst this works, it not particuarly elgant, so I was wondering if something like this was possible
Dim MyArray(2,2)
MyArray(1,1)="ShipTable"
MyArray(1,2)="ShipTableFlds"
MyArray(2,1)="HBLsTable"
MyArray(2,2)="HBLsTableFlds"
For oCounter = 1 to 2
for iCounter = 1 to 2
addFieldDescription MyArray(oCounter,iCounter), ShipTableFlds(oCounter, iCounter), ShipTableFlds(oCounter,iCounter)
Next
next
Where MyArray(x,y) would return a reference to a variable not a value.
In my foxPro days this used to be called Macro Substitution. Is there an equivalent in VBA?
At the moment, my code looks like this (this is just part of it)
For Counter = 1 To NoOfShipFlds
addFieldDescription ShipTable, ShipTableFlds(Counter, 1), ShipTableFlds(Counter, 2)
Next
For Counter = 1 To NoOfHBLsFlds
addFieldDescription HBLsTable, HBLsTableFlds(Counter, 1), HBLsTableFlds(Counter, 2)
Next
Whilst this works, it not particuarly elgant, so I was wondering if something like this was possible
Dim MyArray(2,2)
MyArray(1,1)="ShipTable"
MyArray(1,2)="ShipTableFlds"
MyArray(2,1)="HBLsTable"
MyArray(2,2)="HBLsTableFlds"
For oCounter = 1 to 2
for iCounter = 1 to 2
addFieldDescription MyArray(oCounter,iCounter), ShipTableFlds(oCounter, iCounter), ShipTableFlds(oCounter,iCounter)
Next
next
Where MyArray(x,y) would return a reference to a variable not a value.
In my foxPro days this used to be called Macro Substitution. Is there an equivalent in VBA?