Displaying Records associated with Distinct Column Values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sheraz1
    New Member
    • Mar 2008
    • 3

    #1

    Displaying Records associated with Distinct Column Values

    Hi,
    I am new to VBA, I am trying to create a form that will take the DISTINCT values of a one column and then display all the records associated to that value in the form. I am not sure how clear was that, but this example will make it clear. I have this table with two columns Supplier and the PartNo.

    Supplier PartNo
    A 1
    A 2
    A 3
    B 1
    B 2
    C 1


    I want to create a form that will be like this (there is a tab between the alpabets and the numbers. due to some reason on posting they are very close to each other).


    Supplier 'A'
    Parts
    1
    2
    3

    The next record will be

    Supplier 'B'
    Parts
    1
    2

    and so on. Seems like a simple one but when I make the form control source a query using the DISTINCT keyword on Supplier column, I get is

    Supplier 'A'
    Parts
    -----
    -----
    -----

    Three blank rows which are actually the no. of distinct values. Any help on this will greatly appreciated.
    Thanks.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You need to use a continuous subform in a continous form to get the look you desire. And you won't use the DISTINCT keyword. The problem is not a matter of distinctiveness .

    Comment

    • sheraz1
      New Member
      • Mar 2008
      • 3

      #3
      Actually the main form I don't want to be continous as I want to click the next and back button to move from a supplier to supplier. But I think i can try using the continous sub-form and see how it goes.
      Thanks

      Comment

      • sheraz1
        New Member
        • Mar 2008
        • 3

        #4
        It worked as I wanted it to be, thanks a lot.

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Not a problem, good luck.

          Comment

          Working...