Mark A Matte
markamatte at hotmail.com
Tue Feb 14 12:30:43 CST 2012
>From what you described...it sounds like you want your HAVING criteria and if it is null: Move your criteria from HAVING to WHERE and add an or: WHERE ((((Min(Switches.Switch_Date))>[tbl Injection Profiles to Run]![Test Date]+365)) OR Min(Switches.Switch_Date) is null) ; I can't rememeber but you may have to also modify the select with a CASE (IIF in Access) statement: iif(isnull(Min(Switches.Switch_Date)) = true, NULL, Min(Switches.Switch_Date)) Just a guess... Mark A. Matte > From: marksimms at verizon.net > To: accessd at databaseadvisors.com > Date: Mon, 13 Feb 2012 14:23:15 -0500 > Subject: Re: [AccessD] Query not working as expected. > > Oh, if only to have Access retain the formatting in SQL view ! > I mean what...that's probably 10 lines of code somewhere ? > Pretty Print is my savior for this big gaffah. > > Chester, try this: > > > > SELECT > > A.WellNumber, > > A.[Test Date], > > Min(B.Switch_Date) AS MinOfSwitch_Date > > FROM [tbl Injection Profiles to Run] AS A > > LEFT JOIN Switches AS B > > ON B.Well = A.WellNumber > > GROUP BY > > A.WellNumber, > > A.[Test Date] > > HAVING > > (Min(B.Switch_Date)>(A.[Test Date]+365)) > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com