By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,376 Members | 3,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,376 IT Pros & Developers. It's quick & easy.

ALTER TABLE to rename a field with a variable

P: 98
I am trying to rename a field (fldRateField) in a table (tblClientTable). Whenever I run this code, I get a compile error and the "tblClientTable" variable is highlighted. Any help as to why it doesn't like my variable?

Dim fldRateField As String
Dim tblClientTable As String
fldRateField = Forms!frmDailyClient!lstFieldList
tblClientTable = Forms!frmDailyClient!lstTableList
ALTER TABLE tblClientTable RENAME COLUMN fldRateField TO MarketPrice
Oct 19 '06 #1
Share this Question
Share on Google+
1 Reply

P: 179
I don't know if you can rename a field on the fly. If you can, it's not done with the ALTER TABLE statement. ADD COLUMN or ALTER COLUMN can only be used with ALTER TABLE. RENAME COLUMN cannot be used.

You may have to rename the field from the design view of the table. Just a word of caution.... if you rename fields in your table, it may affect all queries, forms, etc. that are associated with that table.

Oct 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.