Results 1 to 5 of 5
  1. #1
    mjwillyone is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    11

    Selecting most recent entry in a table

    Hello,



    I am creating a report in Microsoft Access 2007.

    I have two tables (with the following fields

    Table 1: Name
    Fields:
    projid (text)
    firstname
    lastname


    Table 2: Dates
    Fields:
    id
    projid (text) - linked to the projid field from the table above
    annualspringattendance (text)

    The Name database holds the names of our employees and their id number. The Dates database holds a listing of the meeting attendance of all of our employees. I am attempting to create a report that will show each employee and in large print the most recent meeting attended, then in much smaller print, the next 2 meetings.

    I am not sure how this is done since this must look at the projid, then look at the entries made and select the entry for a given projid that is last in the list (the most current) and work backwards to find a few others (if there are any.)

    It must also have something shown if there are no records for a given projid.

    Thank you SO much!
    Mike

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    join the 2 tables. bring down name and meeting date. (which I dont see. do you have the date?)
    turn on totals, set max on meeting date. MAX(meetingDate)

    make another query using the one above to pull proj ID for that person and that date.

  3. #3
    mjwillyone is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    11
    Thank you for the insight. The date is actually in the "annualspringattendance" field. This is a text field, not a date field... not sure if this makes a difference.

    The fact that the field that holds the date is not actually a date field means that it can't necessarily be sorted...

    Mike

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    yes, dates are not texts. you should have a DATE field for dates.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by mjwillyone View Post

    ...This is a text field, not a date field... not sure if this makes a difference...
    It not only means you can't sort on it...you can't do any meaningful manipulation with it...including determining 'the most recent meeting attended!'

    Go to Table Design and change the it to a DateTime Field. If the data is entered in a correct date format, you won't lose any data, despite the warning the Access Gnomes will give you when you do this! As always, it's a good idea to make a copy of the Table before making a major change like this!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 1
    Last Post: 12-08-2014, 06:16 PM
  2. lookup the most recent date for an entry
    By sdel_nevo in forum Forms
    Replies: 2
    Last Post: 06-03-2013, 01:30 AM
  3. Selecting foreign key values on data entry
    By hardya in forum Access
    Replies: 4
    Last Post: 02-11-2010, 11:56 AM
  4. Return most recent entry for each item
    By GenAp in forum Queries
    Replies: 1
    Last Post: 02-04-2010, 05:30 AM
  5. Pulling most recent data from child table
    By davidv43 in forum Access
    Replies: 0
    Last Post: 02-07-2009, 11:36 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