[AccessD] Query not working as expected.

Kaup, Chester Chester_Kaup at kindermorgan.com
Tue Feb 14 12:49:48 CST 2012


Thank You!

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Tuesday, February 14, 2012 12:31 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Query not working as expected.


>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
 		 	   		  
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list