I'm having some sytax issues with my VBA code using embedded SQL statements in my DoCmd. Specifically, I have a table that is generated in my code dynamically. This is fine. When this table 'POC2' is created the columns are named with 'tempstr' prefacing the column heading.
For example, let's sya tempstr is 'bill' the I will have a column called bill_Obj, BUT I just want to rename the column (AFTER THE TABLE IS CREATED) to Obj. I have been trying to figure out how to construct my Command to accurately rename the column 'bill_Obj' to just 'Obj'
I have tried:
DoCmd.RunSQL "ALTER TABLE POC2 RENAME COLUMN " & tempstr & "_Obj' TO Obj;"
DoCmd.RunSQL "ALTER TABLE POC2 RENAME COLUMN " & tempstr & " + '_Obj' TO Obj;"
DoCmd.RunSQL "ALTER TABLE POC2 RENAME COLUMN " & tempstr & " & '_Obj' TO Obj;"
I can NOT figure out the proper sytax to make this happen - help!