Results 1 to 5 of 5
  1. #1
    RosaCat is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2019
    Posts
    22

    Exclamation Grouping strings from multiple records

    MS ACCESS HELP



    I have two tables:

    Table1
    WorkOrderNumber Customer Techs
    WO200053 Customer1
    WO200100 Customer2
    WO200301 Customer3
    WO201234 Customer4







    Table2
    WorkOrderNumber Tech Hours
    WO200053 MS 1
    WO200053 GR 1
    WO200053 MP .5
    WO200100 PR 3
    WO200301 MS 1.5
    WO200301 PR 1
    WO201234 GR 1
    WO201234 MP .25












    I need to group the Techs in “Table2” by Work Order Number and then enter them into the “Techs” field in “Table1”.

    The end result for “Table1” should look something like this:

    WorkOrderNumber Customer Techs
    WO200053 Customer1 MS, GR, MP
    WO200100 Customer2 PR
    WO200301 Customer3 MS, PR
    WO201234 Customer4 GR, MP







    Is this possible?

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    Not without some VBA. Have a gander at this: http://allenbrowne.com/func-concat.html

    Usage example:
    Code:
    SELECT WorkOrderNumber, Customer,  ConcatRelated("Tech", "Table2", "WorkOrderNumber=" &  WorkOrderNumber) AS Techs FROM Table1

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Possible, but not advisable. Requires a fair amount of code to get data in and out.
    If that's how your tables really look I'd advise you to research db normalization as it will help immensely if you get it right. You are repeating data in tables, have no primary keys, no related foreign keys and worse, you want to concatenate values into a field for no good reason (you might think you have one but I suspect it isn't good enough). In your example, you would not be able to get a sum of hours for any one tech - unless you plan on keeping the same data somewhere else in the proper fashion, which would just be another example of repeating data in other tables. Maybe take a look at these or find ones you like better:

    Normalization Parts I, II, III, IV, and V
    http://rogersaccessblog.blogspot.com...on-part-i.html
    and/or
    http://holowczak.com/database-normalization/

    Entity-Relationship Diagramming: Part I, II, III and IV
    http://rogersaccessblog.blogspot.com...ng-part-i.html

    How do I Create an Application in Microsoft Access?
    http://rogersaccessblog.blogspot.com...cation-in.html
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    You would not really do that if the data could be updated.?
    What happens if a tech was missed off by accident?

    You should calculate it each time?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    RosaCat is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2019
    Posts
    22
    Thank you everyone. I really am just learning as I go.

    I appreciate all the suggestions and links to the information!!!!

    Have a Great Day!
    Rosa

    Quote Originally Posted by RosaCat View Post
    MS ACCESS HELP

    I have two tables:

    Table1
    WorkOrderNumber Customer Techs
    WO200053 Customer1
    WO200100 Customer2
    WO200301 Customer3
    WO201234 Customer4







    Table2
    WorkOrderNumber Tech Hours
    WO200053 MS 1
    WO200053 GR 1
    WO200053 MP .5
    WO200100 PR 3
    WO200301 MS 1.5
    WO200301 PR 1
    WO201234 GR 1
    WO201234 MP .25












    I need to group the Techs in “Table2” by Work Order Number and then enter them into the “Techs” field in “Table1”.

    The end result for “Table1” should look something like this:

    WorkOrderNumber Customer Techs
    WO200053 Customer1 MS, GR, MP
    WO200100 Customer2 PR
    WO200301 Customer3 MS, PR
    WO201234 Customer4 GR, MP







    Is this possible?

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

Similar Threads

  1. Replies: 8
    Last Post: 05-18-2018, 12:38 PM
  2. Replies: 1
    Last Post: 05-16-2018, 07:31 PM
  3. Testing for Multiple Strings
    By J Bhujanga in forum Programming
    Replies: 3
    Last Post: 02-13-2017, 10:17 PM
  4. Complex search through strings in records
    By pkstormy in forum Code Repository
    Replies: 2
    Last Post: 03-17-2012, 11:25 AM
  5. Grouping strings
    By Fre in forum Access
    Replies: 16
    Last Post: 04-24-2010, 03:46 PM

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