[AccessD] Query result problem

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Sep 30 10:56:43 CDT 2009


When I run the following query I get results for each month from 1/1/1995 to 8/1/2009.

SELECT [qry Injection Data for Oil and Gas Production Allocation].Well_In_CO2PAT, 
[qry Injection Data for Oil and Gas Production Allocation].Well_in_CO2PAT_API, 
[qry Injection Data for Oil and Gas Production Allocation].ProductionMonth, [qry Injection Data for Oil and Gas Production Allocation].Other_Pattern, [qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well, 
[qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well_API, 
[qry Injection Data for Oil and Gas Production Allocation].TRBI 
INTO [tbl 3 Month Running Inj for O and G Alloc]
FROM [qry Injection Data for Oil and Gas Production Allocation]
WHERE ((([qry Injection Data for Oil and Gas Production Allocation].Well_In_CO2PAT)="56-26") 
AND (([qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well)="56-2A"))
ORDER BY [qry Injection Data for Oil and Gas Production Allocation].ProductionMonth, 
[qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well;

When I run the following query I only get results from 4/1/2008 forward. This worked fine in Access 2003. I am now using Access 2007.
Data from 1/1/1995 to 4/1/2008 is 0's if that makes a difference.
No I did not write these queries - an engineer did.

SELECT [qry Injection Data for Oil and Gas Production Allocation].Well_In_CO2PAT, 
[qry Injection Data for Oil and Gas Production Allocation].Well_in_CO2PAT_API, 
[qry Injection Data for Oil and Gas Production Allocation].ProductionMonth, [qry Injection Data for Oil and Gas Production Allocation].Other_Pattern, [qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well, 
[qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well_API, 
[qry Injection Data for Oil and Gas Production Allocation]![TRBI]+
[qry Injection Data for Oil and Gas Production Allocation_1]![TRBI] AS 3mo_rbi 
INTO [tbl 3 Month Running Inj for O and G Alloc]
FROM [qry Injection Data for Oil and Gas Production Allocation] 
INNER JOIN [qry Injection Data for Oil and Gas Production Allocation] AS [qry Injection Data for Oil and Gas Production Allocation_1] 
ON ([qry Injection Data for Oil and Gas Production Allocation].Well_in_CO2PAT_API = [qry Injection Data for Oil and Gas Production Allocation_1].Well_in_CO2PAT_API) 
AND ([qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well_API = [qry Injection Data for Oil and Gas Production Allocation_1].Other_Pattern_as_Well_API)
WHERE ((([qry Injection Data for Oil and Gas Production Allocation].Well_In_CO2PAT)="56-26") 
AND (([qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well)="56-2A") 
AND (([qry Injection Data for Oil and Gas Production Allocation_1].ProductionMonth)=DateAdd("m",-1,
[qry Injection Data for Oil and Gas Production Allocation]![ProductionMonth])))
ORDER BY [qry Injection Data for Oil and Gas Production Allocation].ProductionMonth, 
[qry Injection Data for Oil and Gas Production Allocation].Other_Pattern_as_Well;


Thanks for your assistance.

Chester Kaup
Engineering Technician
Kinder Morgan CO2 Company, LLP
Office (432) 688-3797
FAX (432) 688-3799

 
No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.





More information about the AccessD mailing list