Tim,
One possible solution would be to build the 'Alter table' command as a
string adding each column name to it and then using 'Run Command' to
execute it:
Dim CmdStr As String
CmdStr = "Alter Table " + table + " (Drop "
For i = 1 To numColumnsToRemove
Print "Removing column " + Str$(i)
CmdStr = CmdStr + columnsToRemove(i)
If I <> numColumnsToRemove Then
CmdStr = CmdStr + ", "
Else
CmdStr = CmdStr + ")"
End If
Print CmdStr
Run Command CmdStr
Next
End Sub
You might also find it easier to use col1, col3 etc instead of the
actual column name, as this will make the string shorter.
HTH
Greg Driver
System Administrator
Applications Support
ICT
Surrey Police
NOT PROTECTIVELY MARKED
*Internet communications are not secure and therefore Surrey Police does not accept legal responsibility for the contents of this message. This email and any attachments may be confidential. They may contain privileged information and are intended for the named addressee (s) only. They must not be distributed without our consent. If you are not the intended recipient, please notify us immediately and delete the message and any attachments from your computer, do not disclose, distribute, or retain this email or any part of it. Unless expressly stated, opinions in this email are those of the individual sender, and not of Surrey Police. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. Surrey Police reserves the right to monitor all email communications through their networks.*