Results 1 to 4 of 4
  1. #1
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60

    Post Query question

    Hi

    I have a table with these two fields, among others
    Item ............................ Related items
    1 3,4,5
    2 6,7,8
    3
    4
    6 11
    7 15,18

    If [Item] 1 is late to arrive, I need to notify [Related Items] of the lateness. To do this, I would need to create intermediate table on the fly and looks like this:
    Item Related Item
    1 3
    1 4
    1 5
    6 11
    7 15
    7 18


    .
    .
    .

    the table is large. Therefore, I am trying to avoid writing a VBA to parse the string to array and then write the arrays to a Table. It would take too long.

    I would appreciate a pointer to how to structure a query to so.

    thank
    Mike

  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,770
    What are related items that they would need 'notification'? What is nature of notification - email?

    It is not necessary to write array to a table just to refer to the RelatedItem elements. A query cannot parse an unknown number of elements from a string into separate fields or records. This requires VBA.

    Alternatives are multi-value field or a related table for RelatedItem records.
    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
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60
    Hi June7

    thanks for the reply.
    it appears that the text got altered ... spaces collapsed.

    this line
    Item ............................ Related items
    1 3,4,5

    is supposed to read as
    Item
    1
    Related Items
    3,4,5

    so if Item 1 is late, I want the many to many table that I would like to generate via a query to show
    pairs
    1 and 3
    1 and 4
    1 and 5

    the 1 will be in the Item Field
    and the 3,4,and 5 will be in the Related Items field

    based on that info, I then do another process to notify, via email or otherwise. But for here, the pasring the most important.

    Thank you

  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,770
    Don't think that alters my comments.

    Item and RelatedItems are fields of the same table? RelatedItems is a text field with string value? Because the number of elements for each record is not consistent, requires VBA to 'expand' the elements. VBA can loop through recordset, parse the RelatedItems to an array, then loop through the array and do something with each element. Move to next Item record, if any, and repeat.

    A multi-value field can be expanded by query.

    A related table would have the records already in 'expanded' structure.
    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. Query Question
    By data808 in forum Queries
    Replies: 5
    Last Post: 01-09-2014, 02:39 AM
  2. Query Question
    By sdy007 in forum Queries
    Replies: 1
    Last Post: 08-21-2013, 03:44 PM
  3. query question
    By jscriptor09 in forum Queries
    Replies: 10
    Last Post: 05-01-2013, 09:49 PM
  4. Query question
    By j2curtis64 in forum Queries
    Replies: 8
    Last Post: 07-29-2011, 01:45 PM
  5. Query Question
    By Guiseppe in forum Queries
    Replies: 5
    Last Post: 03-23-2010, 04:32 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