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

Rename a field name using code with variables

P: 98
Hi, can anyone help me with the code necessary to rename a field in an access table. I have tried the ALTER TABLE method but it doesn't like my variable names. Here is the code and thank you for any help!
ALTER TABLE tblClientTable RENAME COLUMN fldRateField TO "MarketPrice"
Oct 12 '06 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Take the quotes of MarketPrice.



Hi, can anyone help me with the code necessary to rename a field in an access table. I have tried the ALTER TABLE method but it doesn't like my variable names. Here is the code and thank you for any help!
ALTER TABLE tblClientTable RENAME COLUMN fldRateField TO "MarketPrice"
Oct 14 '06 #2

P: 98
I took the quotes off MarketPrice, but I still get a compile/syntax error and my variable tblClientTable seems to be the problem. Could it be that I haven't declared this variable properly?

Dim fldRateField As String
Dim tblClientTable As String
fldRateField = Forms!frmDailyClient!lstFieldList
tblClientTable = Forms!frmDailyClient!lstTableList
ALTER TABLE tblClientTable RENAME COLUMN fldRateField TO MarketPrice

Thank you for any additional help!
Oct 16 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Try:

Dim fldRateField As Field
Dim tblClientTable As Table


I took the quotes off MarketPrice, but I still get a compile/syntax error and my variable tblClientTable seems to be the problem. Could it be that I haven't declared this variable properly?

Dim fldRateField As String
Dim tblClientTable As String
fldRateField = Forms!frmDailyClient!lstFieldList
tblClientTable = Forms!frmDailyClient!lstTableList
ALTER TABLE tblClientTable RENAME COLUMN fldRateField TO MarketPrice

Thank you for any additional help!
Oct 16 '06 #4

Post your reply

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