[AccessD] Compile Error - Object Required

Charlotte Foust cfoust at infostatsystems.com
Wed Jan 28 09:56:10 CST 2009


Why are you using Set with assigning values to your variables?  

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Wednesday, January 28, 2009 6:51 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Compile Error - Object Required

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.

--
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