Kaup, Chester
Chester_Kaup at kindermorgan.com
Tue May 26 11:00:17 CDT 2009
Forgot to add if I replace API12 with '42415017530000' the code works fine. API14 also shows to have a value in it. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Tuesday, May 26, 2009 10:53 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Too few parameters expected 1 Chester: When I get that error message, I copy the SQL into the SQL view of a query and then go to the design view. Usually I can see the problem right away that way. Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Tuesday, May 26, 2009 8: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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com