Results 1 to 6 of 6
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Joining/linking two fields

    In query design view, table 1 has a field called VIPno (27 alpha characters). Table 2 has a field called ChargeNo (30 alpha characters).

    In Table 2, the first 27 digits are the same as the VIPno in table one. Therefore, I need to use the LEFT function to extract the first 27 characters in ChargeNo from table 2, then join them.

    So in my design grid, I have VIPno in there. For the second field, I have VIPcode: Left([ChargeNo],27). Then in the table area I simply drag and drop between the two fields I want to join together.



    When I go to view my results, it is blank. Do you have to drag and establish the links before entering the LEFT function or vice versa, or does that not matter. As far as I can tell it does not matter.

    I suspect that there are some inherent restrictions on joining a field to another field that has a function (e.g. LEFT) acting upon it.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I just tested joining tables on fields that are both Calculated type using Left() function.

    You can do this in table Calculated field.

    Or build a query that extracts the value then join that query to the other table. This query doesn't have to be saved query object, can be nested with an alias name, typed into SQL View.

    SELECT table1.*, Q1.* FROM table1 INNER JOIN (SELECT *, Left([ChargeNo],27) AS VIP FROM table2) AS Q1 ON table1.VIP = Q1.VIP;
    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
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    I just tested joining tables on fields that are both Calculated type using Left() function.

    You can do this in table Calculated field.

    Or build a query that extracts the value then join that query to the other table. This query doesn't have to be saved query object, can be nested with an alias name, typed into SQL View.

    SELECT table1.*, Q1.* FROM table1 INNER JOIN (SELECT *, Left([ChargeNo],27) AS VIP FROM table2) AS Q1 ON table1.VIP = Q1.VIP;
    I went with your suggestion about building another query and that worked. Thank you.

    What do you mean by table calculated field? Do you mean having the 30 digit alphanumeric in one column, and then in the next column set up a calculated field with the LEFT function to extract the first 27 characters?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Yes, Calculated type field in table is an option.

    How is the 30 character value input into table? Is this imported data?
    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.

  5. #5
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    Yes, Calculated type field in table is an option.

    How is the 30 character value input into table? Is this imported data?
    Yes it is imported. Why might that matter? Does it affect the use of a calculated field?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    No, does not. Was just wondering why it is not imported as the 27-character value you need. The remaining 3 characters could be in another 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.

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

Similar Threads

  1. Replies: 7
    Last Post: 03-19-2013, 02:04 PM
  2. Joining Memo Fields
    By Njliven in forum Queries
    Replies: 2
    Last Post: 12-28-2012, 12:34 PM
  3. Replies: 2
    Last Post: 05-29-2012, 07:13 PM
  4. Joining 2 fields in query to make one
    By robsworld78 in forum Queries
    Replies: 5
    Last Post: 07-11-2011, 12:06 AM
  5. Replies: 0
    Last Post: 03-04-2011, 10:28 AM

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