Dan Waters
dwaters at usinternet.com
Tue May 26 10:49:09 CDT 2009
In your select string, perhaps API14 should be syntaxed something like: dbo_DSS_CompletionMaster.PID = '" & API14 & "') Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Tuesday, May 26, 2009 10:41 AM To: Access Developers discussion and problem solving Subject: [AccessD] Too few parameters expected 1 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. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com