OK this one isn't vital or anything, I was just curious...
Inevitably I run across a field that has spaces in the heading. E.G. Field 1. Recently I have done so with a huge table filled with these types of field names (i.e. field names with spaces).
When I drag and drop these fields down ina query, Access seems to recognize the field names with spaces and doesn't put brackets around these values by default in the GUI... however, if I click the SQL statement that is made, all the field names with spaces appear with brackets around them and the ones that don't have spaces do not.
The kicker is that if you now change this from a SELECT query to an APPEND query, when you choose the table to append to... Access will auto fill all the fields with the same names, put brackets around the fields that have spaces.
Then when you try to run the append query Access throws this error:
When you look at the SQL, though, everything that should have brackets does... so how do you fix it?
The answer is to remove the brackets in the GUI, but this is very time consuming if you have a table with a ton of "spaced field names".
The crazy thing is that once you remove the brackets in the GUI, Access remembers that you've deleted them. But where? How? Even if I remove the brackets in the GUI, if I then look in the SQL the brackets are there for both the INSERT INTO and the SELECT statement... So how does Access know, to leave the brackets off, at the append line, once you've deleted them?
Because I inherited a GIANT table filled with these types of field names, whenever I create an append table, I have to go through and delete all the brackets by hand... this is uber-lame!
Does anyone know of an easier way to deal with this? Or how I can get Access to force brackets initially, for field names with spaces. Seems that'd be a setting or something... why would they force brakctes for the instert but not for the select? It doesn't make any sense. Seems like if that throws an error they'd want to keep it consistent.
Anyway, if you have some insight as to the best way to deal with this, I'd be please to learn something new... I know what some of you might say... but please don't tell me not to use spaces in field names... that won't be helpful as I already know not to do this... like I said, sometimes the rest of the world doesn't know it's a no no
Thanks,
Gary
Inevitably I run across a field that has spaces in the heading. E.G. Field 1. Recently I have done so with a huge table filled with these types of field names (i.e. field names with spaces).
When I drag and drop these fields down ina query, Access seems to recognize the field names with spaces and doesn't put brackets around these values by default in the GUI... however, if I click the SQL statement that is made, all the field names with spaces appear with brackets around them and the ones that don't have spaces do not.
The kicker is that if you now change this from a SELECT query to an APPEND query, when you choose the table to append to... Access will auto fill all the fields with the same names, put brackets around the fields that have spaces.
Then when you try to run the append query Access throws this error:
The INSERT INTO statement contains the following field name:'[Field 1]' Make sure you have typed the name correctly, and try the operation again.
When you look at the SQL, though, everything that should have brackets does... so how do you fix it?
The answer is to remove the brackets in the GUI, but this is very time consuming if you have a table with a ton of "spaced field names".
The crazy thing is that once you remove the brackets in the GUI, Access remembers that you've deleted them. But where? How? Even if I remove the brackets in the GUI, if I then look in the SQL the brackets are there for both the INSERT INTO and the SELECT statement... So how does Access know, to leave the brackets off, at the append line, once you've deleted them?
Because I inherited a GIANT table filled with these types of field names, whenever I create an append table, I have to go through and delete all the brackets by hand... this is uber-lame!
Does anyone know of an easier way to deal with this? Or how I can get Access to force brackets initially, for field names with spaces. Seems that'd be a setting or something... why would they force brakctes for the instert but not for the select? It doesn't make any sense. Seems like if that throws an error they'd want to keep it consistent.
Anyway, if you have some insight as to the best way to deal with this, I'd be please to learn something new... I know what some of you might say... but please don't tell me not to use spaces in field names... that won't be helpful as I already know not to do this... like I said, sometimes the rest of the world doesn't know it's a no no

Thanks,
Gary