Kaup, Chester
Chester_Kaup at kindermorgan.com
Wed Aug 17 08:37:32 CDT 2005
Myds4 is the result of a select query that uses the DayInMonth2 function. I appears that each time a record that the query generates is accessed it runs the function. Just as a test I changed the query to a make table query and changed the code to use the make table query. Now no calling of the function occurs. Go figure? -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid Sent: Wednesday, August 17, 2005 8:03 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Why is function being called?? I figured so, I was just making sure. So you are saying that DaysInMonth2 is being called when you execute the line myds1.Fields(2) = Nz(myds4.Fields(8)) If so, the only thing that I can think of that might cause this is some sort of corruption in the FE. Have you tried a decompile/compile or importing the FE into a new FE? Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Wednesday, August 17, 2005 8:12 AM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Why is function being called?? My mistake DaysInMonth2 is a function. It is declared as an integer. Thanks for looking. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid Sent: Wednesday, August 17, 2005 6:51 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Why is function being called?? I don't understand. You are saying that DaysInMonth is a function. Yet your code has: DaysinMonth = DaysInMonth2(myds3.Fields(1)) By this, DaysInMonth2 is the function. How is DaysInMonth declared? Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Tuesday, August 16, 2005 5:24 PM To: Access Developers discussion and problem solving Subject: [AccessD] Why is function being called?? Below is a piece of code. DaysInMonth is a function. When the code runs and hits the line myds1.Fields(2) = Nz(myds4.Fields(8)) the function runs. I don't see anything that is calling it. Your thoughts appreciated. Do Until myds4.EOF DaysinMonth = DaysInMonth2(myds3.Fields(1)) If Day(myds3.Fields(1)) < DaysinMonth And RecordCounter = 1 Then StartCounter = Day(myds3.Fields(1)) ProdDate = myds3.Fields(1) Else StartCounter = 1 ProdDate = myds4.Fields(1) End If For I = StartCounter To DaysinMonth myds1.AddNew myds1.Fields(0) = ProdDate myds1.Fields(1) = myds4.Fields(0) myds1.Fields(2) = Nz(myds4.Fields(8)) myds1.Update ProdDate = ProdDate + 1 Next I RecordCounter = RecordCounter + 1 myds4.MoveNext Loop Chester Kaup -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com