Results 1 to 5 of 5
  1. #1
    Noewon is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    3

    modifying data from ODBC

    Hi



    I'm using tables created from a linked ODC source. One of the fields from the original database has leading spaces, which is affecting any attempts to run a query. The corresponding field in another table has no spaces

    So essentially the SQL would be querying: WHERE " 123" = "123". How do i strip the leading spaces?

    I've tried using a "create table" query and then running an update on that, but no dice. I've tried:

    UPDATE test2 SET test2.contract_no = Trim([contract_no]);

    But this just gives the same string with leading spaces.

    I must admit I'm still at a basic level on this side of things, if any further information is required, let me know.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I ran your update query on a table in A2K3 and it removed the leading space.

    Try executing this query. What happens?

    Code:
    SELECT Test2.contract_no, Len([contract_no]) AS LenNoTrim, Len(Trim([contract_no])) AS LenTrim FROM Test2;
    Do you get LenNoTrim = 4 and LenTrim = 3 ???

  3. #3
    Noewon is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    3
    The actual data has more characters, but adding your extra code did return the right numbers.

    I must be screwing up the syntax somewhere in my original query...

  4. #4
    Noewon is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    3
    Got it. It was a syntax error. Thanks for your help.

  5. #5
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You are welcome

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

Similar Threads

  1. Help needed in modifying Function
    By Alex Motilal in forum Programming
    Replies: 4
    Last Post: 02-06-2011, 11:59 PM
  2. Update Query: Modifying Data Using Top Values
    By William McKinley in forum Queries
    Replies: 1
    Last Post: 11-30-2010, 02:20 PM
  3. Modifying a Split Form?
    By robertrobert905 in forum Access
    Replies: 0
    Last Post: 10-26-2010, 08:00 AM
  4. ODBC -- call failed. | Oracle ODBC
    By drdexter33 in forum Access
    Replies: 1
    Last Post: 04-03-2010, 09:32 PM
  5. Replies: 0
    Last Post: 08-30-2006, 02:50 AM

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