[AccessD] is this date affected?

A.D. Tejpal adtp at airtelmail.in
Sat Apr 16 22:57:47 CDT 2011


David,

    Another alternative could be considered.

    You wish to ascertain whether date Dt2 falls on one of the alternate Saturdays starting from Dt1 which is a Saturday.

    If the test is to be reflected via a Boolean variable IsAffected, the following could be tried:

    IsAffected = ((Dt2 - Dt1) Mod 14 = 0)

    If the condition is to be checked in an If / End If block, the syntax could be as follows:

    If (Dt2 - Dt1) Mod 14 = 0 Then

Best wishes,
A.D. Tejpal
------------

  ----- Original Message ----- 
  From: Rocky Smolin 
  To: 'Access Developers discussion and problem solving' 
  Sent: Saturday, April 16, 2011 22:44
  Subject: Re: [AccessD] is this date affected?


  There's a Weekday function in VBA that you pass a date to and it returns a
  number from 1 to 7 - Sunday=1, 7=Saturday.  Might be helpful?

  Rocky
   

  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
  [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
  Sent: Saturday, April 16, 2011 8:59 AM
  To: accessd at databaseadvisors.com
  Subject: Re: [AccessD] is this date affected?

  Hi David

  You can build a collection of the dates using a loop and DateAdd.
  Then look up your date in this collection.

  /gustav


  >>> davidmcafee at gmail.com 16-04-2011 01:35 >>>
  I was wondering if anyone already has some code or Jet SQL to determine if a
  date is affected?

  Such as  Every other Saturday for the next x Saturdays starting 4/16/2011
  (2011.04.16 ;)  )

  Is 4/30/2011 one of those saturdays?  (Yes) Is May 7th? (no)

  I was going to write a function, but I was wondering I am re-inventing the
  wheel, or if there is some built in too to do so.

  Thanks,
  David


More information about the AccessD mailing list