[AccessD] Trying to avoid coding

David McAfee davidmcafee at gmail.com
Tue Jun 2 11:53:31 CDT 2015


I'd save this as a query (just to keep Access from making it's normal
subquery ugliness):
SELECT fldBNYMeetingID, Max([YourInterimQuery].[YourDateField]) AS
LastMeetingDate, Min([YourInterimQuery].[YourDateField]) as
NextToLastMeetingDate
FROM (SELECT DISTINCT TOP 2 fldBNYMeetingID, fldBNYMeetingDate FROM
YourTable ORDER BY fldBNYMeetingDate DESC) AS A

Now join your table to the query on fldBNYMeetingID

On Tue, Jun 2, 2015 at 6:49 AM, Rocky Smolin <rockysmolin at bchacc.com> wrote:

> Steve:
>
> OK - ran into a little problem.  To be more specific, the table has four
> fields -
>
> 1) fldBNYMeetingIDAutonumber ID (can be ignored),
> 2) fldBNYID (FK to the tblBNY where BNY is a table of clients),
> 3) fldBNYMeetingDate
> 4) fldBNYMeetingTypeID (FK to a table of meeting types.
>
> So what I need is the last two meeting records for each fldBNYID. The query
> needs all three fields 2, 3, and 4, in order to get the two dates needed by
> Client to push out to the spreadsheet.
>
>
>
> Any ideas?
>
> TIA
>
> Rocky
>
>


More information about the AccessD mailing list