Results 1 to 2 of 2
  1. #1
    Whit is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2018
    Posts
    7

    Run a query when a fieldname contains one or more spaces.

    I am trying to run a query in Access SQL. The table I am querying has a number of field names that contain one more spaces in them.


    One such field name is Serial ID (Filler9) . It is a field in in records in the table, tblit. Trust me, I did not come up with that field name.

    I keep reading that by surrounding the field name with brackets [ ] , it will work fine in a query. Not all of the time
    for me.

    Below are several queries I ran with this field name. It seems that it will always work as an item in a select list, but in where clauses it sometimes works and sometimes doesn't. When it doesn't work, it is considered a parameter, which means it is not recognized as a field in a record in the table. I cut and pasted the field from a query that worked into all the other queries, so I know the field name is spelled properly.

    Any ideas on how to get it to work all the time?


    This one works

    INSERT INTO tblErr ( LetterSerialID )
    SELECT [Serial ID ]
    FROM tblIT;



    This one does not work.



    This one works.

    SELECT tblIT.[Serial ID (Filler9)]
    FROM tblIT
    LEFT JOIN tblVendor ON tblVendor.filler9= tblIT.[Serial ID (Filler9)];
    -------------------------------------------------------------------
    This One does not work








    __________________________________________________ ___________________
    This one does not work

    ----------------------
    ------------------------------------------------------------------------------------------------


    This one works

    select tblIT.[Serial ID (Filler9)] from tblit
    where tblIT.[Serial ID (Filler9)] > ''



    This one works

    INSERT INTO tblErr ( LetterSerialID )
    SELECT [Serial ID (Filler9)]
    FROM tblIT
    where [Serial ID (Filler9)] > ''



  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Seem to be missing all the 'does not work' examples. Might edit your post to clarify.

    Cannot replicate issue. I tested with a similar name field and query works fine.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-07-2018, 02:57 PM
  2. Replies: 7
    Last Post: 10-11-2013, 03:28 PM
  3. Replies: 1
    Last Post: 04-16-2013, 07:57 PM
  4. Spaces Stripped from Append Query Field
    By alawless in forum Queries
    Replies: 11
    Last Post: 08-08-2011, 10:45 PM
  5. Replies: 14
    Last Post: 11-16-2010, 03:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums