Table field name with space

T

Terry

I accidentally created a table field name with a space in
it. Is there a way to remove the space in VBA? I've
already distributed the application to end users and I
don't have access to their back-end data except through
VBA in a new front-end version. Thank you for your help.
 
S

Steve Schapel

Terry

It would be possible. You could write some code to run a couple of SQL
statements using ALTER TABLE. I think you would have to ADD the
replacement field, run an Update Query to transfer the data from the
existing field to the new one, and then remove (DROP) the existing
field. But is this all necessary? What actually is the problem?
 
K

Ken Snell [MVP]

Not to mention having to reestablish any relationships that exist for the
current field, and having to rewrite forms/reports/VBA code/macros that use
that field name.....
 
D

Douglas J. Steele

You can rename a field, at least you can using DAO:

CurrentDb().TableDefs("MyTable").Fields("My Badly Named Field").Name =
"MyGoodName"

You'd still have some, but not all, of the issues Ken raised though. (there
wouldn't be a problem with relationships)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top