Results 1 to 6 of 6
  1. #1
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176

    Take data from 'group by' that will put all the nonduplicate data into fields, help?

    Not very sure on your to title this but here is what I have

    Project ControlNumber
    1 30
    1 31
    1 32
    1 33
    2 45
    2 46
    2 47
    3 56

    Eventually I want to get

    Project ControlNumber
    1 30,31,32,33
    2 45,43,47
    3 56

    I've look around and there only seems to be slq solutions that I've tried but haven't gotten to work, partly because I have no idea what I'm doing, What I figured would be easier to do is to get this

    Project CN1 CN2 CN3 CN4 CN5 ect... (as the fields)

    EX:
    1 30 31 32 33 all in one row

    And then use & to combine it into the format CN1,CN2,CN3... as what would be in the rows.

    Now my question is how to do the first part (1 30 31 32 33), is this possible?




    Sorry I'm new to all of this I've only been using access for a week :/
    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I'd use a function like this:

    http://allenbrowne.com/func-concat.html

    As to your thought on layout, it would normally be a big mistake to have fields like CN1 CN2 CN3 etc. The concept is called normalization:

    Fundamentals of Relational Database Design -- r937.com
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    See the thing is that I've tried this, it doesn't work and i have no idea why..

    noob here

    Edit:
    So I did it all again and when I try to run the query it tells me that ConcatRelated() is an undefined funtion, even though I went into the VBA application, copied it exactly, complied and saved. What could be going wrong here?


    Also, I don't think it would be normalizing because I have to take all thos individual values and make tables with them as the primary key

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Make sure you copied the function into a standard module, not behind a form or report, and that the module does not have the same name as the function, which will confuse Access.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    I've gotten almost everything to work, but when I try to specify the field [ControlNumber] as the first part of the function for some reason it does not let me. I get the error message:
    "You tried to execute a query that does not include the speficifed expression ___ as part of the aggregate function"
    If I type in [ContractNumber] (the same as Project) then it works but obvioulsy with the wrong number, it even shows the right amount of entires.
    I tried to enter ([co]![ControlNumber]) (thats the table from where it comes) but I get another error message.
    Any Ideas?
    Thanks so much!

    Edit: Figured it out, Thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Report with Age groups data under each group
    By jyellis in forum Reports
    Replies: 1
    Last Post: 03-10-2013, 05:12 PM
  2. Replies: 0
    Last Post: 02-25-2013, 04:43 PM
  3. Replies: 2
    Last Post: 06-21-2012, 07:40 PM
  4. Group By with Fix Row data
    By Somnath_IT2006 in forum Queries
    Replies: 3
    Last Post: 01-12-2012, 10:54 PM
  5. Data group by week
    By hoachen in forum Access
    Replies: 2
    Last Post: 09-09-2011, 08:37 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