Results 1 to 4 of 4
  1. #1
    ker9 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    5

    Parameter Date - Force a Monday Date


    Hi, Is there a way to force a user to either choose a Monday as the start date or to calculate the next Monday from an entered start date so that the query always begins on a Monday?
    Thank you.
    Last edited by ker9; 07-26-2011 at 12:42 PM.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'll bet you can fine what you want on this link: http://www.pacificdb.com.au/Support/code_datetime.htm

  3. #3
    ker9 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    5
    Thank you - that was helpful.
    This gets me the next monday.
    Code:
    DateAdd("d",8-Weekday([dte],2),[dte])
    I've been trying to add an IIF statement to it that will determine if the parameter date entered is a Monday, use that date, if not get the next Monday.

    I don't understand the syntax and can't get it..
    Code:
    DateAdd("d",IIf(Weekday([dte],2)=2,2,8-Weekday([dte],2)),[dte])
    Thanks for any assistance.

    EDIT:
    I got it!
    Code:
    IIf(Weekday([dte])=2,[dte],(DateAdd("d",8-Weekday([dte],2),[dte])))
    Last edited by ker9; 07-26-2011 at 12:42 PM. Reason: Solution Found

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Thanks for posting back with your solution.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date Range Parameter help!?!?
    By dkstech in forum Access
    Replies: 1
    Last Post: 01-15-2011, 11:05 AM
  2. Replies: 4
    Last Post: 10-27-2010, 02:57 PM
  3. Future date parameter
    By normie in forum Queries
    Replies: 10
    Last Post: 08-12-2010, 09:38 PM
  4. Date Parameter Help - prior 13 weeks
    By acw1980 in forum Access
    Replies: 1
    Last Post: 11-12-2009, 10:30 AM
  5. Date Parameter
    By shakira in forum Queries
    Replies: 2
    Last Post: 03-09-2006, 12:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums