Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Posts
    4

    Question Unanswered: Selecting n records from databse with query

    I am tyring to limit the maximum number of records returned by a querie to a combo box on an access form. For some weird reason using SELECT TOP n * FROM sometable etc... does not limit the number of records returned and setting the MaxRecords property doesnt do anything either. Is there a function that I can build that would make a querie only return say 30 records and populate the combo box with the 30 records? (I can get it to populate the combo box but it returns many many records still) if you need more info let me know.

    - Craig

  2. #2
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120

  3. #3
    Join Date
    Sep 2002
    Posts
    4
    Bah TOP was working all along its just the data I was using to test with wasnt acurate enough =) TOP was returning the information best it could. It's just i had 1000 #1's, 1000 #2's etc so when I wanted to pull the top 30 out it would return 1000 #1's (all tied for top 30)

    I'm wondering in that case though would there be a way to ONLY return 30 values even if 1000 entries tie for 1st place? (eg for the above example return only 30 #1's even though theres 1000 #1 entries)

    This may sounds way out there but who knows =)

    - Craig

  4. #4
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91
    Use TOP 30 query, save it as qry1

    Then create qry2:
    SELECT TOP 30 FROM qry1;

  5. #5
    Join Date
    Sep 2002
    Posts
    4

    Talking

    That works perfectly thanks Djoko!

    - Craig

Posting Permissions

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