Thanks John...
When I saw your answer I asked myself why had I not thought of the []. Appreciate the help.
-Tylendal
"John Nurick" wrote:
[Quoted Text] > Hi Tylendal, > > strField1 = "1A" > strField2 = "4C" > strTable = "MyTable" > > strSQL = "SELECT [" & strField1 & "], [" & strField2 & "] " _ > & "FROM " & strTable & ";" > > > > On Sat, 16 Sep 2006 06:05:01 -0700, Tylendal > <Tylendal[ at ]discussions.microsoft.com> wrote: > > >I would like to write a single SQL statement that would allow me to place > >different table names as needed and specify specific fields from this table. > > > >The issue I am stumbling over is there are 30+ fields that have names like > >1A, 2B, 4C, etc. > > > >Each time the SQL runs I wish to select a specific field but for some reason > >I get syntax errors. I can assign the field to a variable but getting the > >variable into the SQL seems to be the issue. The SQL works fine if I > >identify the field as 1A, 2B etc. but using the variable I get the error. > > > >Appreciate your assistance. > > > >Tylendal > > -- > John Nurick [Microsoft Access MVP] > > Please respond in the newgroup and not by email. >
|