Results 1 to 8 of 8
  1. #1
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54

    Linking 2 Fields, How to Omit First two Digits during Link

    I am trying to link up two fields that are close, but not completely identical.

    Here are the two fields:

    Field 1:

    Order



    5004645554

    Field 2:

    ORDER_NUM

    005004645554


    There are two zeros before each of the order numbers in the other field...how to I properly link these two?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    You cannot join on this data, not directly. You can do a query of one of the tables, include a constructed field that formats the value as needed. Then join the query with the other table using this constructed field.
    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.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    One way is to create a query on one table that creates a new field in the appropriate format. In subsequent queries, join on that query instead of the original table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    FYI, you can join the tables directly with this type of thing:

    SELECT...
    FROM OneTable INNER JOIN OtherTable ON Mid(OneTable.FieldName, 3) = OtherTable.FieldName

    or the reverse, using the format function to pad zeros. The problem is that it the query design grid can't represent it, so you have to work in SQL view from then on.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    Can you give me an example of a "consructed field"? Or maybe how to create one?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    In SQL view:

    SELECT FieldName, Mid(FieldName, 3) AS ConstructedFieldName
    FROM TableName

    In design view

    ConstructedFieldName: Mid(FieldName, 3)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Construct a field with an expression in the query designer grid. Access Help has more guidance.

    As pbaldy pointed out, can join the tables if build the query in SQL View window of the Query Designer by typing the statement. Can use the Query Designer to build a SELECT query joining on the two fields and retrieving desired fields (or wildcard for all) then in the SQL View modify as needed. After modifying for this structure, won't be able to view in the Design View.
    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.

  8. #8
    KrenzyRyan is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    54
    This worked great, thanks guys!

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

Similar Threads

  1. Expression to conditionally omit info
    By Niki in forum Access
    Replies: 3
    Last Post: 05-16-2011, 10:21 AM
  2. Replies: 0
    Last Post: 03-04-2011, 10:28 AM
  3. Fields not Linking to Table
    By jlclark4 in forum Forms
    Replies: 2
    Last Post: 12-20-2010, 08:04 AM
  4. How to link subform using two fields
    By rohnds in forum Forms
    Replies: 1
    Last Post: 08-04-2010, 04:44 AM
  5. omit word in entry for alphabetical order
    By airhud86 in forum Access
    Replies: 1
    Last Post: 12-14-2009, 03:49 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