Results 1 to 12 of 12
  1. #1
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34

    Identifying available sizes


    Hi, I am new in this form and I hope someone helps me to resolve my problem,
    I have a table containing Model name including produce sizes after hyphen "-", but each model can contain in many different sizes
    Example
    Model
    SH001-24
    SH001-36
    SH001-48
    SH004-12
    SH004-18
    SH004-20
    SH004-22
    What I want as query is
    Model Size
    SH001 -24, -34, -48
    SH004 -12, -18, -20, -22
    So basically the task is to remove all before dash, and list as unique record and combine all available size in same model in Size Column
    Thank you in advance.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,444
    your data is not really set up correctly to do what you want - I don't know what business you are in but I would have expected the model and size to be in different columns, perhaps even in separate tables.

    The first thing you need to do is to split your field into the two elements. Based on the examples provided the model part is all the same length of 5 chars so to get this part use the left function - Left(model,5)

    and your sizes are all two characters, so use the right function - Right(model,2)

    So create a query called say ModelSplit

    SELECT Left(model,5) AS ModelName, Right(model,2) AS ModelSize
    FROM myTable

    to get the sizes to appear as one field, you will need to use the concatrelated function which you will find here http://allenbrowne.com/func-concat.html. Copy and paste it into a new module

    now create another query which will be something like

    SELECT DISTINCT ModelName, Concatrelated("ModelSize","ModelSplit","ModelName= '" & ModelName & "'") AS Sizes
    FROM ModelSplit

    If your model name and/or size has varying lengths then you will need to use a different method for extracting them. Not prepared to go into that now because it may not be necessary and before offering a solution we would need to know the entire range of possibilities

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,811
    Retracted.
    Duplicate information.

  4. #4
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34
    Thank you for respond, However as I instructed I created a module, Copy and paste it and compile it but the function dasn't appear anywhere, it identicates as Unidentified function 'Concatrelated" in expression. is it possible to email a functioning access file?
    Thank you so much

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,811
    You can post a db here. See if this helps you to do that
    https://www.accessforums.net/showthread.php?t=70301

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,728

  7. #7
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34

    File to review

    I created 2 sets of tables, one is my sample the other one is based on the instructions Allen Browne's
    Thanks
    Attached Files Attached Files

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,444
    you should read my advice more closely. This works

    Code:
    SELECT DISTINCT Query1.Modele, concatrelated("Size","Query1","Modele='" & [modele] & "'") AS Sizes
    FROM Query1;
    and produces this

    Modele Sizes
    SH001 24, 36, 48
    SH004 12, 18, 20, 22

  9. #9
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34
    My problem is the concatrelated function dasnt work and I don't know why it's not working
    Attached Thumbnails Attached Thumbnails Capture.JPG  

  10. #10
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34
    Can you please check if the module is working and attach it?
    Thanks

  11. #11
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,444
    the file you sent in post #7 works, including the module and function. I didn't change anything other than write the query.

    Perhaps it is a setting on your computer which is preventing code from running?

  12. #12
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34
    Thanks, that was the setting.
    Best!!

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

Similar Threads

  1. Incongruous database file sizes
    By gar in forum Misc
    Replies: 12
    Last Post: 12-05-2017, 04:26 AM
  2. How do i customize tile sizes on my form?
    By cpzering in forum Forms
    Replies: 6
    Last Post: 03-22-2015, 02:09 PM
  3. Replies: 1
    Last Post: 12-04-2012, 11:46 PM
  4. Field Sizes Isues
    By djclntn in forum Queries
    Replies: 4
    Last Post: 12-07-2011, 07:55 PM
  5. Different Screen sizes
    By KevinH in forum Access
    Replies: 0
    Last Post: 07-23-2009, 12:07 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