Results 1 to 8 of 8
  1. #1
    coach123 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    Connecticut
    Posts
    3

    Programming daylight savings time on a form

    Standard Time/ Daylight Savings time

    FORM:
    A5=Now()

    IIF([A5] between #3/12/2017 2:00:00:00 AM# and #11/5/2017 2:00:00:00 AM#,”Standard”,”Daylight”)

    This Doesn’t work, What do I need to change this too?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    "Doesn't work" tells us nothing at all.

    I would think the two descriptions need to be swopped.

  3. #3
    Join Date
    Apr 2017
    Posts
    1,673
    Iif(Month([A5])+Day([A5])/100.00 Between 3.13 AND 11.04,"Daylight","Standard")

    (I'm not sure abouth months and days here - never couldn't grasp US date formats)

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Code:
    IIF([A5] between #3/12/2017 2:00:00:00 AM# and #11/5/2017 2:00:00:00 AM#,Standard,Daylight)
    There are a couple of things that are wrong.

    1) there are too many 00's in the time string. Should be> hh:mm:ss. (3 groups) ..... You have 4 groups of numbers .....
    2) the "double quotes" are wrong ASCII value.

    This works in a query
    Code:
    test: IIf([A5] Between #3/12/2017 2:00:00 AM# And #11/5/2017 2:00:00 AM#,"Standard","Daylight")

  5. #5
    coach123 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    Connecticut
    Posts
    3
    Steve thanks for the correction on the time.
    I copied the code you suggested, and I got this error:

    You may have entered a comma without a preceding value of identifier.

    You are close to the solution, any more thoughts?

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Did you change the symbols around Standard and Daylight to double quotes?

    Look at this....
    Attached Files Attached Files

  7. #7
    coach123 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    Connecticut
    Posts
    3
    Quote Originally Posted by coach123 View Post
    Steve thanks for the correction on the time.
    I copied the code you suggested, and I got this error:

    You may have entered a comma without a preceding value of identifier.

    You are close to the solution, any more thoughts?
    Steve
    After I corrected the the extra 00's, It still wasn't accepting the code, and Yes I went back to my original with the ",", and it still wasn't working, access kept changing the code when I tried to save it. It kept putting [] brackets in.

    =IIF([A5]Between #3/12/2017 2:00:00 AM# and #11/5/2017 2:00:00 AM #,”[Standard]”,”[Daylight]”)

    =IIF([A5]Between #3/12/2017 2:00:00 AM# and #11/5/2017 2:00:00 AM #,”Standard”,”Daylight”)

    I tried this several times and each time it kept putting the brackets in, then without any changes it all of a sudden accepted is, and it now works fine.

    All is OK now, thanks very much for your input.

  8. #8
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Glad you got it working....

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

Similar Threads

  1. Replies: 4
    Last Post: 05-29-2015, 09:36 AM
  2. Help with Programming a Form, Please!
    By jake_haley in forum Programming
    Replies: 3
    Last Post: 06-20-2013, 12:05 PM
  3. Loan and Savings Database
    By misscupid in forum Access
    Replies: 1
    Last Post: 03-11-2013, 02:44 AM
  4. Replies: 3
    Last Post: 09-23-2012, 08:48 PM
  5. Db form programming?
    By swat in forum Programming
    Replies: 19
    Last Post: 09-02-2011, 02:22 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