Results 1 to 2 of 2
  1. #1
    matt1000 is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    3

    Problem updating fields from one table to another, but the data does not match

    Hello,



    My problem is this, I am attempting to update multiple fields from one table to another. However, the data within the fields doesn't match exactly in the field which I am joining the tables on.

    An example:

    tbl1.Invoice_No = 12345-01
    or
    tbl1.Invoice_No = ABC9876

    tbl2.Invoice_No = 12345
    or
    tbl2.Invoice_No = 9876

    Attempted Variations of the following SQL Statement:

    UPDATE tblAnalysis_file SET tblAnalysis_file.completed = "Complete", tblAnalysis_file.chart = "Disregard", tblAnalysis_file.status = "On AP Invoice Table", tblAnalysis_file.comments = "Approved But Previously Failed "
    WHERE (((tblAnalysis_file.Invoice_No) LIKE (tblAp_Invoice.Invoice_No)));


    Where the problem lies for me, besides this not obviously working, is how to get Access to, in a way execute a trim function. Some "Invoice_No" 's will have leading, or lagging, extra information in one table, but not in the other table.

    Any help is gratefully appreciated in advance!

    Regards,

    Matt r.

  2. #2
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    You will probably need to use VBA code, but you can just use Trim as an Expr if you really want.

    Expr1: Trim([Fieldname])

    Or


    This might be useful to you:

    Code:
     
    Dim MyString, TrimString
    
    MyString = "  <-Trim->  "    ' Initialize string.
    
    TrimString = LTrim(MyString) 
    ' TrimString = "<-Trim->  ".
    
    TrimString = RTrim(MyString)
    ' TrimString = "  <-Trim->".
    
    TrimString = LTrim(RTrim(MyString)) 
    ' TrimString = "<-Trim->".
    
    ' Using the Trim function alone
    ' achieves the same result.
    TrimString = Trim(MyString) 
    ' TrimString = "<-Trim->".
    Good luck

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

Similar Threads

  1. Unstack Data and Match with Unique ID
    By lukejones in forum Queries
    Replies: 7
    Last Post: 02-24-2014, 08:33 AM
  2. Updating Table Data Automatically
    By aquarius in forum Import/Export Data
    Replies: 6
    Last Post: 09-16-2010, 03:07 PM
  3. Updating data within a form/table.....
    By softspoken in forum Forms
    Replies: 3
    Last Post: 04-15-2010, 06:33 PM
  4. data type mis match
    By cowboy in forum Programming
    Replies: 3
    Last Post: 03-12-2010, 11:54 AM
  5. Finding data that doesn't match
    By dlhayes in forum Queries
    Replies: 1
    Last Post: 11-11-2006, 08:14 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