Results 1 to 7 of 7
  1. #1
    stottle is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    2

    Find Spaces in Field

    Hello All,

    I have a field in a table where data repeats its self many times.

    But, some of the fields have a many spaces after the text.

    eg

    A040 (with nine space characters at the end)
    A040 (with no characters at the end)
    A040 (with nine space characters at the end)
    A859 (with nine space characters at the end)
    A859 (with nine space characters at the end)
    A859 (with nine space characters at the end)


    etc

    Can i run a query on the field to find all records that have spaces after the A040 so when i run a report from crystal and group the data it shows it all in one line rather crystal thinking it is two different lines of text.

    i've tried

    like "* *"

    but my knowledge of access queries is very limited.

    Thanks in advance
    stottle

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you want to eliminate the spaces then you can use the Trim() function.

  3. #3
    stottle is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    2
    hi, thanks for you reponse,

    i should have explained before becuase i won't be able to change the data through access as i'm only using access to look at the data which is an SQL database.

    I just need to be able to find the data (along with some other fields) and then pass it to a 3rd party for them to do something on the database.

    Thanks again
    Stuart

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about
    Code:
    InStr([YourField],"   ") > 0
    ...to find fields with at least three spaces in them?

  5. #5
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    In your query use Left(Field,4). Simples

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So you want to return all of the records where the Len([YourField]) > 4 right?

  7. #7
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    RG,

    Don't think so it seams that he want to group by code and as SQL text is providing trailing spaces due to its datatype, by only using the left 4, as I suggested earlier, he can group by this column in his query so that items with and without trailing spaces are grouped as one.

    David

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

Similar Threads

  1. Replies: 4
    Last Post: 07-22-2009, 02:33 PM
  2. Replies: 9
    Last Post: 07-16-2009, 09:13 PM
  3. query to find the highest value in a field
    By jhjarvie in forum Queries
    Replies: 0
    Last Post: 09-02-2008, 02:27 PM
  4. How do I find the serial value of Now()?
    By JoeG in forum Queries
    Replies: 0
    Last Post: 03-13-2007, 08:16 AM
  5. Deleting Spaces
    By grgerhard in forum Import/Export Data
    Replies: 2
    Last Post: 04-30-2006, 06:42 PM

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