Fred Hooper
fahooper at trapo.com
Thu Apr 13 09:42:58 CDT 2006
Hi Chester, I've had intermittent problems for reasons I don't understand with functions in queries. I would try two changes: (1) ProdPattern]![Date] <-- ProdPattern].[Date]) (2) Declare the function as Static, e.g. Static Function DaysInMonth2(D As Variant) As Variant I've had both changes work for me, but sometime not. Fred Hooper -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Thursday, April 13, 2006 9:41 AM To: Access Developers discussion and problem solving Subject: [AccessD] Ambiguous Nmae in Query Expression I have a function in a module as follows: Function DaysInMonth2(D As Variant) As Variant When I try to use the function in a query I get the message Ambiguous Name in Query Expression (DaysInMonth2([ProdPattern]![Date]) AS Expr1) This is the first time I have tried to use a user defined function in a query. I need some help on how to do this. Thanks The SQL is a follows: SELECT ProdPattern.PID, ProdPattern.Date, ProdPattern.vm_wtri, ProdPattern.vm_co2i, [qry Pattern Days on Injection by Fluid].vm_dyswtri, [qry Pattern Days on Injection by Fluid].vm_dysco2i, DaysInMonth2([ProdPattern]![Date]) AS Expr1 FROM ProdPattern INNER JOIN [qry Pattern Days on Injection by Fluid] ON (ProdPattern.PID = [qry Pattern Days on Injection by Fluid].PID) AND (ProdPattern.Date = [qry Pattern Days on Injection by Fluid].Date) WHERE (((ProdPattern.PID)=[Pattern Name])); 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