Results 1 to 9 of 9
  1. #1
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20

    Display last two recorded value for a client

    Hi Guys,

    I would like some help in extracting the last two recorded values for a client in a given table. There are 2000+ clients with various Blood pressure readings, hence a client may have anything from 1 to 40+ readings on different dates, and I would like to list the readings from the last two attendance dates only. I can extract the last readings but how do I extract the last two readings for the 2000+ clients? Table is [BP_Readings] and the fields to list from this table will be (Client_ID), (Reading_1), (date1), (Reading_2) and (date2).

    Any help on this will be much appreciated. Thank you.



    DD
    x

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    You might consider the following table set up (normalization).

    ClientID
    ReadingDate
    ReadingValue




    records with date1, date2 raise a red flag suggesting a non normalized structure.

  3. #3
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Sure thanks. Slight change as I need to get all the readings from a cut-off date (January 2015) and not just the last two per client. Any help please?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    As I said, get your table designed for database.
    The set up I showed will give you all the flexibility you need.

    See this for database design info
    Good luck.

  5. #5
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Thank you. The database is in Access 2003. It has all been set up. I need to extract all ReadingValue for a client from January 2015 (ReadingDate) for the 2000 clients and display it in Excel with one row per Client, is this possible?

    Currently I have 6000+ rows of data with multiple records for each client listing the ReadingDate and ReadingValue sitting on individual rows.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Please give us 2 sets of sample data (you can mock it up but it should show record layout)

    1: A few typical records to show the table/record layout
    2: A sample of what the output should look like

  7. #7
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by orange View Post
    Please give us 2 sets of sample data (you can mock it up but it should show record layout)

    1: A few typical records to show the table/record layout
    2: A sample of what the output should look like

    It actually doesn't make sense for me now as the fields (Value and date) are not differentiated in the name:

    Layout:

    ClientID Name ReadingDate ReadingValue
    1 Smith 01/01/2016 120/75
    1 Smith 02/03/2016 130/80
    3 Ramsay 04/04/2016 170/92
    3 Ramsay 08/09/2016 180/100
    3 Ramsay 01/12/2016 170/95
    8 Connor 05/05/2016 140/75
    8 Connor 02/03/2017 125/91


    Desired Output:
    ClientID Name ReadingDate ReadingValue ReadingDate ReadingValue ReadingDate ReadingValue
    1 Smith 01/01/2016 120/75 02/03/2016 130/80
    3 Ramsay 04/04/2016 170/90 08/09/2016 180/100 01/12/2016 170/95
    8 Connor 05/05/2016 140/75 02/03/2017 125/91


    Am I looking for something impossible with my knowledge of Access?

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849

  9. #9
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Durga View Post
    Thank you. The database is in Access 2003. It has all been set up. I need to extract all ReadingValue for a client from January 2015 (ReadingDate) for the 2000 clients and display it in Excel with one row per Client, is this possible?

    Currently I have 6000+ rows of data with multiple records for each client listing the ReadingDate and ReadingValue sitting on individual rows.
    Two other options would be to:
    1) use VBA to write all of the data to a CSV (text) file, then import into Excel.
    2) use automation (VBA) and write the data directly into the Excel workbook.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-25-2014, 01:14 PM
  2. Charting Un-Recorded Points
    By ahorta86 in forum Programming
    Replies: 1
    Last Post: 06-18-2014, 04:06 PM
  3. Replies: 9
    Last Post: 02-28-2014, 03:23 PM
  4. Form Actions Not being Recorded
    By CementCarver in forum Forms
    Replies: 2
    Last Post: 06-15-2013, 06:24 PM
  5. Replies: 1
    Last Post: 07-26-2011, 06:10 AM

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