Results 1 to 10 of 10
  1. #1
    Join Date
    May 2003
    Posts
    6

    Unanswered: Select x last records to show in a report

    Hi
    Ive got a database that keeps track of visits made to some clients this year. While some clients had 2, 3 visits, others had more than 10! Id like to limit the number of visits shown in a report to 8. How could i do that?
    Thanks

    WarLordz

  2. #2
    Join Date
    Apr 2003
    Location
    Manchester, NH
    Posts
    57

    Re: Select x last records to show in a report

    You could use a simple if statement in the displaying field like:

    If visits >= 8 then 8;

    That really is the easiest way to do it that I can think of.

    Dalynching


    Originally posted by WarLordz
    Hi
    Ive got a database that keeps track of visits made to some clients this year. While some clients had 2, 3 visits, others had more than 10! Id like to limit the number of visits shown in a report to 8. How could i do that?
    Thanks

    WarLordz

  3. #3
    Join Date
    May 2003
    Posts
    6

    Re: Select x last records to show in a report

    Im sorry, but i couldnt understand where would i put this statement... How can i count the number of visits ?
    I have just started using access, so im sorry if im asking something this basic...
    Thanks


    Originally posted by dalynching
    You could use a simple if statement in the displaying field like:

    If visits >= 8 then 8;

    That really is the easiest way to do it that I can think of.

    Dalynching

  4. #4
    Join Date
    Aug 2002
    Posts
    31
    Maybe the simplest way to handle this is in the underlying query, sort decending based on the date and up on the menu bar, there is an option for only returning a specific number of records.. specify 8 and you should get the results you want.

    Have fun!

  5. #5
    Join Date
    May 2003
    Posts
    6
    But by doing this, itll return the 8 latest visits to all clients!!!!
    I just want to get the 8 latest visits to a especific client!
    Thanks anyway!!

    Originally posted by Maia
    Maybe the simplest way to handle this is in the underlying query, sort decending based on the date and up on the menu bar, there is an option for only returning a specific number of records.. specify 8 and you should get the results you want.

    Have fun!

  6. #6
    Join Date
    Aug 2002
    Posts
    31
    Specify the Client ID in the query.

  7. #7
    Join Date
    May 2003
    Posts
    6
    Again, im sorry if this question is too stupid, but how can i do that??
    Thanks for your help!!!

    Originally posted by Maia
    Specify the Client ID in the query.

  8. #8
    Join Date
    Aug 2002
    Posts
    31
    Please tell me how you wish your data to be displayed.. is it a report you have designed? If it is, there should be a query underlying that report that you can modify to return only the records you want. If there is a query, and you can find it by chosing the properties menu item, and you will see a list. One of the items is data source... click on the button beside that. That will take you to the Query Builder. When you are there, choose View, SQL from the menu, and cut and paste the query into a post here and I will try to help you.

  9. #9
    Join Date
    May 2003
    Posts
    6
    SELECT TOP 8 Table_Mov.Operation, Table_Mov.ID, Table_Mov.Date, Table_Mov.Fund, Table_Mov.Value, Table_Mov.Justification
    FROM Table_Mov
    ORDER BY Table_Mov.Date DESC;

  10. #10
    Join Date
    May 2003
    Posts
    6
    i forgot to mention, but this is a subreport, which is linked to the main report by the ID
    thanx

Posting Permissions

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