Results 1 to 6 of 6
  1. #1
    glasgowlad1999 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    14

    Question Date flag

    Hi There,



    What is the best way to flag a record that is due within 3 days.

    I have a date received lets say 11/23/2010 and it is due in 30 days. I want to flag that record in a datasheet when it is within 3 days. However, if it is due on the Monday. I need it to not count the weekends as days.

    Thanks.

  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
    Here's a function I use:
    Code:
    Public Function AdjWorkDays(dteStart As Date, _
                                intNumDays As Long, _
                                Optional blnAdd As Boolean = True) As Date
    AdjWorkDays = dteStart
    Do While intNumDays > 0
       If blnAdd Then
          '-- Adding WorkDays
          AdjWorkDays = AdjWorkDays + 1
       Else
          '-- Subtracting WorkDays
          AdjWorkDays = AdjWorkDays - 1
       End If
       If Weekday(AdjWorkDays, vbMonday) <= 5 Then
    '-- Use the following code instead, if you have a "Holiday" table
    '   If Weekday(AdjWorkDays, vbMonday) <= 5 _
          And IsNull(DLookup("[Holiday]", "tblHolidays", _
          "[HolDate] = " & Format(AdjWorkDays, "\#mm\/dd\/yyyy\#;;;\N\u\l\l")))  Then
          intNumDays = intNumDays - 1
       End If
    Loop
    End Function

  3. #3
    glasgowlad1999 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    14
    Rural,

    You are great.

    One question AdjWorkDays = AdjWorkDays + 1 it this where I plus my 30 days?

    so today + 30 - 5 days to flag it.

  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
    YourDate: =AdjWorkDays([OriginalDate],30-5)
    ...should do it.

  5. #5
    emilyrogers is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2010
    Posts
    46
    Thank You! I have been trying to do this also! I havent implemented this into my database yet- where/how does the alert appear?

    thanks

  6. #6
    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
    Quote Originally Posted by emilyrogers View Post
    Thank You! I have been trying to do this also! I havent implemented this into my database yet- where/how does the alert appear?

    thanks
    You would need to use a query, domain function or form to examine the calculated date and post the message.

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

Similar Threads

  1. flag in access
    By bold01 in forum Access
    Replies: 9
    Last Post: 02-03-2011, 11:08 AM
  2. Query to flag daily change in order status
    By Relyuchs in forum Queries
    Replies: 1
    Last Post: 01-21-2011, 02:53 PM
  3. Proper way to handle a flag system
    By trb5016 in forum Access
    Replies: 0
    Last Post: 08-25-2010, 01:20 PM
  4. Flag A Data Block
    By JohnBoy in forum Programming
    Replies: 7
    Last Post: 06-29-2010, 01:18 PM
  5. Multi-select listbox and update flag in table
    By Suresh in forum Programming
    Replies: 0
    Last Post: 12-19-2007, 01:04 AM

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