Kaup, Chester
Chester_Kaup at kindermorgan.com
Tue May 26 10:40:41 CDT 2009
Here is the code the generates the error. The SQL statement does not seem to be reading the variable API14. It is dimmed as text. Set RS1 = MyDb.OpenRecordset("dbo_DSS_StatusChanges") Set RS2 = MyDb.OpenRecordset("dbo_DSS_CompletionMaster") RS2.MoveFirst API14 = RS2.Fields(0) strSql = "SELECT dbo_DSS_StatusChanges.PID, dbo_DSS_CompletionMaster.Well_Number, DateSerial(Year(Date()),Month(Date())-1,1) AS RecordDate, Max(dbo_DSS_StatusChanges.StatusDate) AS MaxOfStatusDate FROM dbo_DSS_StatusChanges INNER JOIN dbo_DSS_CompletionMaster ON dbo_DSS_StatusChanges.PID = dbo_DSS_CompletionMaster.PID WHERE (((dbo_DSS_StatusChanges.StatusDate) <= DateSerial(Year(Date()), Month(Date()) - 1, 1))and dbo_DSS_CompletionMaster.PID = API14) GROUP BY dbo_DSS_StatusChanges.PID, dbo_DSS_CompletionMaster.Well_Number ORDER BY dbo_DSS_CompletionMaster.Well_Number;" Set RS3 = MyDb.OpenRecordset(strSql) 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.