Results 1 to 5 of 5
  1. #1
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46

    Question Message Box Based on Date Range


    I have a Search Form that returns results based on a Start and End Date. I would like to develop a custom message box based on if the "Start" and "End" Date is 5 days or more apart. I was looking at putting something in the [EndDate] validation field within properties, but am stuck on "If =>[StartDate]+5, then "message....". Should I even be looking the Validation field, or is this something that should be considered in the "AfterUpdate" event?

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Take a look at DateDfiff function
    http://www.techonthenet.com/access/f...e/datediff.php

    General logic

    If datediff( "d",startDate, endDate) >=5 then
    'do something

    You might want to do your manipulation in a beforeUpdate event , so you could cancel if needed

    Good luck

  3. #3
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    Orange - good point about placing this in the BeforeUpdate event. I will give it a shot. Thanks!

  4. #4
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    Got it working! Thanks Orange!

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

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

Similar Threads

  1. Date Range with Error Message Box
    By Huddle in forum Access
    Replies: 4
    Last Post: 05-11-2012, 01:33 PM
  2. SUM based on date range in query builder
    By tjstromquist in forum Queries
    Replies: 1
    Last Post: 04-04-2012, 09:07 AM
  3. Query Date Range Based on Calculated Fields
    By wilsoa in forum Queries
    Replies: 6
    Last Post: 03-08-2012, 02:41 PM
  4. joins based on date range
    By broecher in forum Database Design
    Replies: 4
    Last Post: 11-04-2011, 06:32 PM
  5. Replies: 13
    Last Post: 09-27-2010, 03:10 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