Results 1 to 5 of 5
  1. #1
    hari101213 is offline Novice
    Windows 10 Office 365
    Join Date
    Mar 2020
    Posts
    5

    Sharepoint messing up the code. Any idea why?

    Hi Guys,

    I have this code below that restricts back date entries when the current date reaches 15th in April, July and October. Works perfectly on my computer but when i upload it onto SharePoint it no longer takes into consideration that current date must be equal and above 15th first for code to be triggered. It triggers straight away even thou today is only the 13th and stops entries.

    Any idea why once on sharepoint it can no longer understand Date must be higher or equal to 15 first for code to trigger?

    Here is my code. Any help appreciated.

    ' This will run in day #15 in Months 1, 4, 7, and 10 only
    CurrDayMonth = Month(Date)
    If Day((Date) >= 7) And (CurrDayMonth = 1 Or CurrDayMonth = 4 Or CurrDayMonth = 7 Or CurrDayMonth = 10) Then
    If (DATE_IN >= DateSerial(Year(Date), Month(Date), 1)) Then Exit Sub
    MsgBox "Invalid Date .... Date should be Greater than or Equal to " & DateSerial(Year(Date), Month(Date), 1)
    DATE_IN = ""


    DoCmd.GoToControl ("DATE_IN")

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Check your code. I can't see any reference to 15th:
    If Day((Date) >= 7) And (CurrDayMonth = 1 Or CurrDayMonth = 4 Or CurrDayMonth = 7 Or CurrDayMonth = 10) Then
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    parens are wrong:

    Day((Date) )>= 7

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Quote Originally Posted by ranman256 View Post
    parens are wrong:

    Day((Date) )>= 7
    They are indeed but that's not how I would have corrected them...��
    Either of the following also work (taken from the Immediate window)
    Code:
    ?Day(Date())
     13 
    ?Day(Date)
     13 
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    hari101213 is offline Novice
    Windows 10 Office 365
    Join Date
    Mar 2020
    Posts
    5
    Hi Guys,

    I modified my code from If Day((Date) >= 7) to If Day (Date) >= 7 and it looks to have solve the problem on my sharepoint! The 7 was a typo suppose to be 15. Thanks guys!

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

Similar Threads

  1. Error Handling messing up Input Box
    By jtm013 in forum Programming
    Replies: 13
    Last Post: 12-08-2014, 03:03 PM
  2. IFF statement messing up query?
    By offie in forum Queries
    Replies: 4
    Last Post: 07-12-2013, 07:14 AM
  3. Replies: 1
    Last Post: 08-03-2012, 12:32 PM
  4. Replies: 8
    Last Post: 03-07-2012, 01:18 PM
  5. Access email button messing up numbers
    By ninjafly in forum Reports
    Replies: 3
    Last Post: 08-20-2009, 04:27 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