[AccessD] For next loop - using date criteria

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Dec 13 15:44:14 CST 2006


Good idea. Thanks.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Wednesday, December 13, 2006 3:10 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] For next loop - using date criteria

Again, to what purpose?  If you just want to step from the first to the
first, just use DateAdd and add a month to the latest date using an Do
Until loop and testing for a date > the end of the desired range.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Wednesday, December 13, 2006 11:52 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] For next loop - using date criteria

I am trying to loop from 11/1/1948 to 11/1/2006 stepping from the first
day of one month to the first day of the next month.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Wednesday, December 13, 2006 1:36 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] For next loop - using date criteria

Also,

If I may ask...what are you trying to accomplish?

Thanks,

Mark


>From: "Kaup, Chester" <Chester_Kaup at kindermorgan.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "Access Developers discussion and problem 
>solving"<accessd at databaseadvisors.com>
>Subject: [AccessD] For next loop - using date criteria
>Date: Wed, 13 Dec 2006 13:02:05 -0600
>
>I am trying to use date criteria in a for next loop but loop never 
>increments. Loop works if a hard code in a step but with variable. What

>might I be missing? Code below.
>
>
>
>StartDate = #11/1/1948#
>
>EndDate = #11/1/2006#
>
>LoopStart = CLng(StartDate)
>
>LoopEnd = CLng(EndDate)
>
>
>
>For I = LoopStart To LoopEnd Step DaysinMonth
>
>     Debug.Print CVDate(I)
>
>     DaysinMonth = DaysInMonth2(CVDate(I)) + 1
>
>Next I
>
>
>
>
>
>End Function
>
>
>
>Public Static Function DaysInMonth2(D As Date) As Integer
>
>'
>
>' Returns the number of days in a month
>
>' Requires a date argument, since February can change if it's a leap 
>year
>
>' Lets Access figure it out
>
>'
>
>   If VarType(D) <> 7 Then
>
>     DaysInMonth2 = Null
>
>   Else
>
>     DaysInMonth2 = DateSerial(Year(D), Month(D) + 1, 1) - 
>DateSerial(Year(D), Month(D), 1)
>
>   End If
>
>End Function
>
>
>
>
>
>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

_________________________________________________________________
Share your latest news with your friends with the Windows Live Spaces
friends module. 
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http:/
/spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk

--
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
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list