Results 1 to 4 of 4
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Syntax to check if current date is between two date fields


    I have 2 date fields on my form. One is named one and the other is named two

    What is the proper syntax to check if the current date is between these 2 fields ?

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    8,731
    In an unbound text box on a form: the control source would be
    Code:
    =Date()>=[one] And Date()<=[Two]
    Set the Format property of the control box to "True/False"
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Ok, I tried the code below but it does not work. Here is my complete code to check if the current Date is between the current weeks on call period. If so then the other weeks command buttons should be disabled with only the current weeks pay period being enabled. I get no errors, it just does not work. I tried simply FirstWeekThursday.Enabled = False and it works without the date.

    If Date >= [three] And Date <= [four] Then ' Disables Date Buttons for First,Third and Final Week Command Buttons
    FirstWeekThursday.Enabled = False 'code for this is named one
    FirstWeekWednesday.Enabled = False 'code for this is named two
    ThirdWeekThursday.Enabled = False 'code for this is named five
    ThirdWeekWednesday.Enabled = False 'code for this is named six
    FinalWeekThursday.Enabled = False 'code for this is named seven
    FinalWeekWednesday.Enabled = False 'code for this is named eight
    End If

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,217
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 04-03-2012, 07:24 AM
  2. Date Field Check against Saved Date?
    By Heatshiver in forum Programming
    Replies: 8
    Last Post: 03-26-2012, 11:01 PM
  3. Replies: 1
    Last Post: 12-07-2011, 01:02 PM
  4. Check dosent update current date
    By bsunuwar in forum Access
    Replies: 10
    Last Post: 03-23-2011, 09:46 PM
  5. Replies: 9
    Last Post: 03-19-2010, 10:37 AM

Tags for this Thread

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 - Senior Forums