Kaup, Chester
Chester_Kaup at kindermorgan.com
Wed Aug 17 07:59:37 CDT 2005
Problem resolved. Myds4 is the result of a select query that uses the
DaysInMonth2 function. Might speed things up if the query was a make
table and DaysInMonth2 would not have to recalculate all the time.
-----Original Message-----
From: Kaup, Chester
Sent: Wednesday, August 17, 2005 7:11 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