Results 1 to 9 of 9
  1. #1
    chskrao is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    4

    How to match 4 character word or number or combination by identical 4 characters word

    Dear Sir,
    Sub:- How to match 4 character word or number or combination by identical 4 characters word or number or combination in one word have 10 or 15 characters.

    I have to two separate tables (Table A and Table B). Table A has one column (Tag No) and Table B has about 15 columns with one column name Tag No as below

    Table A Table B
    Tag No Tag No
    2009 ZZZ-2030-DC
    2010 ZZZ-2010-M9P
    2110 P216-2031-ER-(EXT)
    2012 ZAL-6630-1-ER2S
    2020 PM-2020-ER1
    2021 PM-6050-ER1
    2022 LSHH-2031-01-M4S
    2023 LSHH-2010-01-M4S
    2030 LSHH-2009C-01-M4S
    2031 LSHH-2110C-01-M4S
    2032 ZZZ-6620-C-M7S
    2033 CM-3710C-M5S
    They're both in MS Access.I am trying to match 2 tables’ columns (Tag No) with join query, but not success. I want to match 4 characters in Table-A with 4 similar characters in Table-B (Tag No) cell.
    What query is suitable to compare two tables. Please help.


    Thank You,
    Rao

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    What have you tried? What was the result?
    What is the meaning of these Tag Nos ZAL-6630-1-ER2S LSHH-2009C-01-M4S??

    In Access we try to use 1 field= 1 fact, and not embed some "intelligence" into codes.

  3. #3
    chskrao is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    4
    In, Table-A “Tag No” is the Equipment Unit number and in Table-B “Tag No” is the Equipment number. I want to know in a particular unit, how many equipment tag numbers have and it’s details (from other columns).
    Thanks
    Rao

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Will
    the 4 numbers / charactres in Tag No in Table B,
    always be after
    the first hyphen ?

    Thanks

  5. #5
    chskrao is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    4
    Yes
    Thanks
    Rao

  6. #6
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Quote Originally Posted by chskrao View Post
    Yes
    Check out INSTR() and MID() functions.


    Quote Originally Posted by orange View Post
    What is the meaning of these Tag Nos ZAL-6630-1-ER2S LSHH-2009C-01-M4S??

    In Access we try to use 1 field= 1 fact, and not embed some "intelligence" into codes.
    Do not know the status at your end, but all the same, request you to take a second look at Orange's response, specifically the last line, in case you have not done so.

    Thanks

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Try something like:

    SELECT TableA.*, TableB.* FROM TableA, TableB WHERE TableA.TagNo = Mid(TableB.TagNo, InStr(TableB.TagNo,"-")+1,4);
    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
    chskrao is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    4
    I used the below criteria. The criteria expression working well. My problem was solved.
    I think, we cannot do this with a join, but in the criteria for tag no in tableb put
    Like "*" & [tablea].[tag no] & "*"
    Thank you for your support.
    Rao

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Like operator is fine as long as the 4 characters will not be repeated in the longer string or it doesn't matter if they are. That's why I suggested extracting the 4 characters with string manipulation.

    The lack of a pk/fk relationship is why the SQL I suggested does not have JOIN clause. This causes a cartesian joining - every record in each table will join with every record of the other table.
    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. Call word object and import word fields
    By silverspr in forum Programming
    Replies: 3
    Last Post: 12-10-2012, 11:32 PM
  2. Replies: 0
    Last Post: 10-04-2012, 01:39 AM
  3. Access to Word - Multiple Word Templates?
    By alpinegroove in forum Programming
    Replies: 11
    Last Post: 06-12-2012, 04:42 PM
  4. Replies: 12
    Last Post: 10-15-2010, 10:03 AM
  5. Count number of identical posts
    By Patience in forum Access
    Replies: 1
    Last Post: 06-16-2010, 04:27 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