Results 1 to 7 of 7
  1. #1
    Leen is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    70

    Smile How to print last 3 visit dates in report


    Hello,

    I have been looking around for quite some time, but I can't seem to find what I am looking for. With 2 experts I have already dealt and I am sure one will find the solution to this one!

    My DB (Access 2010) prints out a report from several subforms. As the last information on the report I'd like to print the last 3 (or the most recent 3) visit dates (with some connected info) on the report. This obviously changes when a new visit is booked.

    I don't have the foggiest idea even where to start.

    Hopefully someone can help me.

    Thanks,

    Leen

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Perhaps TOP N query as the subform RecordSource will serve, something like:

    SELECT TOP 3 * FROM tablename ORDER BY [date field];
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Leen is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    70

    Smile

    Quote Originally Posted by June7 View Post
    Perhaps TOP N query as the subform RecordSource will serve, something like:

    SELECT TOP 3 * FROM tablename ORDER BY [date field];
    Hello June7!

    Nice to "talk" to you again.

    Your response is very appreciated, but I have no clue how to interpret it. I am good in following steps, as I believe are many people.

    The Report is almost ready, except for the "last three dates" (visits) with some accompanying info. This info of course changes when a visit is made.

    Really, I have been looking far and wide on the internet, including your website, but am at wits' end.
    No idea where to start...

    So please, help me as you did before so graciously.

    Thanks

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    Here is the description of TOP and an example and a test area to test changes in the sql.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Suggestion is to use the SQL statement as the subreport RecordSource. Use your table and field names in place of the generic examples I used. The * is wildcard - it will pull all fields. If you don't want all fields, then enumerate them in place of the *.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Leen is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    70

    Smile

    Quote Originally Posted by June7 View Post
    Suggestion is to use the SQL statement as the subreport RecordSource. Use your table and field names in place of the generic examples I used. The * is wildcard - it will pull all fields. If you don't want all fields, then enumerate them in place of the *.
    Could you please give me an example?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    That is an example. What exactly do you not understand about building a query? Use the query designer. The TOP N is an option in the query properties.

    Can build the query directly in the RecordSource property. Click the ellipsis (...) to open the query designer. An Advanced Beginner should already be familiar with this basic Access functionality.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 6
    Last Post: 03-01-2014, 07:07 AM
  2. Replies: 2
    Last Post: 12-02-2013, 04:20 PM
  3. Replies: 1
    Last Post: 05-25-2012, 04:13 PM
  4. Replies: 0
    Last Post: 02-22-2011, 05:04 AM
  5. How To Print Calculated Dates on Report
    By ChrisCione in forum Reports
    Replies: 2
    Last Post: 01-15-2011, 03:26 PM

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