Bobby Heid
bheid at appdevgrp.com
Wed Aug 17 06:51:11 CDT 2005
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