Kaup, Chester
Chester_Kaup at kindermorgan.com
Wed Jan 28 08:50:39 CST 2009
The following piece of code generates the informative message Compile Error - Object Required when it gets to the last SET statement. The variable is dimmed. Somewhere I am missing the problem.
strSql = "SELECT DISTINCT dbo_DSS_WellTests.PID, CDate(Int([TestDate])) AS TestDate1, Nz(LinePees,0) AS Expr1, Nz(TubingPres,0) AS Expr2, " & _
"Switch([ConfigMaster]![PID]='WGRP115',1,[ConfigMaster]![PID]='WGRP116',2,[ConfigMaster]![PID]='WGRP117',3) AS Area " & _
"FROM ConfigMaster INNER JOIN (dbo_DSS_WellTests INNER JOIN dbo_DSS_LastStatus ON dbo_DSS_WellTests.PID = dbo_DSS_LastStatus.PID) ON ConfigMaster.ChildPID = dbo_DSS_WellTests.Well_Name " & _
"WHERE (((dbo_DSS_LastStatus.Status)='WI' Or (dbo_DSS_LastStatus.Status)='CI')) " & _
"GROUP BY dbo_DSS_WellTests.PID, CDate(Int([TestDate])), dbo_DSS_WellTests.LinePres, dbo_DSS_WellTests.TubingPres, " & _
"Switch([ConfigMaster]![PID]='WGRP115',1,[ConfigMaster]![PID]='WGRP116',2,[ConfigMaster]![PID]='WGRP117',3) " & _
"HAVING (((CDate(Int([TestDate]))) > Now() - 365) " & _
"And ((Switch([ConfigMaster]![PID] = 'WGRP115', 1, [ConfigMaster]![PID] = 'WGRP116', 2, [ConfigMaster]![PID] = 'WGRP117', 3)) = 1 " & _
"Or (Switch([ConfigMaster]![PID] = 'WGRP115', 1, [ConfigMaster]![PID] = 'WGRP116', 2, [ConfigMaster]![PID] = 'WGRP117', 3)) = 2 " & _
"Or (Switch([ConfigMaster]![PID] = 'WGRP115', 1, [ConfigMaster]![PID] = 'WGRP116', 2, [ConfigMaster]![PID] = 'WGRP117', 3)) = 3)) " & _
"ORDER BY dbo_DSS_WellTests.PID;"
Set Rs1 = MyDb.OpenRecordset(strSql)
Set PID1 = Rs1.Fields(0)
Set Date1 = Rs1.Fields(1)
Set LinePres1 = Rs1.Fields(2)
Set TubingPres1 = Rs1.Fields(3)
Set Area1 = Rs1.Fields(4)
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.