Results 1 to 3 of 3

Thread: Grouping By A Specific Field

  1. #1
    Join Date
    Dec 2009
    Posts
    79

    Grouping By A Specific Field

    Lets say I have a table in an Access 2007 database with 2 fields: MyNumber & MyText
    The entires are as follows

    1 A
    1 B
    1 C
    2 D
    2 E
    2 F

    and I need to run a query that will display

    1 A B C
    2 D E F

    How would I do that? I have no idea where to start.

  2. #2
    Join Date
    May 2006
    Posts
    407
    I don not thing a query is the way to go. But you can write a report that will do this. Using MyNumber as a grouping field, you can have code in the Detail_Format event. this code would use a variable and just add to the variable the value in the field MyText. The code would look like this:
    Sub Detail_OnFormat(......)
    txtMyText = txtMyText & MyText & " "
    End Sub

    Sub MyNumberHeader_OnFormat(.....)
    TxtMyText = ""
    End Sub

    The two fields, MyNumber and txtMyText would then be printed in the footer grouping of MyNumber

  3. #3
    Join Date
    Dec 2009
    Posts
    79
    Thanks! I'll give this shot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •