Results 1 to 5 of 5
  1. #1
    whisp0214 is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    May 2017
    Posts
    30

    Creating a Date

    I am trying to come up with a way to calculate a date based on another date already entered. Here is the scenario. Company A always pays on the 26th of every month for shipments based off of the previous month. So all orders placed in February, would then be paid on March 26th. Every order has a date ranging from the first of the month to the last as to when it shipped. Basically I would like to add another field to the Purchase Order table that shows the payment date of 3/26/2018 for all 2018 February orders. I have played around with DateAdd and Month/Day/Year, but have not come up with anything. Is there a simple solution to this?



    Thanks in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    And exactly what is the issue? Does the DateAdd calculation not return the correct value? Post the expression.

    DateAdd function is not available to Calculated type field in table. Do calc in query or textbox.
    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.

  3. #3
    whisp0214 is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    May 2017
    Posts
    30
    The issue is there are hundreds of orders in a given month that all have different dates attached to them ranging from the 1st to the last of the month, but they are all paid at the same time. So a 2/1/2018 order and a 2/28/2018 order will be paid on 3/26. How do I have both orders show the same date of 3/26.

    DateAdd('n" , This value is my issue, [Date from Field1])

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,418
    try

    to get to the same day of next month

    dateadd("m",1,mydate)

    subtract the day of the month and add 26

    dateadd("d",26-day(mydate),dateadd("m",1,mydate))

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Another option:
    Code:
    DateSerial(Year(DateAdd("m", 1, OrderDate)), Month(DateAdd("m", 1, OrderDate)), 26)

    In a query:
    Code:
    SELECT OrderDate, DateSerial(Year(DateAdd("m", 1, OrderDate)), Month(DateAdd("m", 1, OrderDate)), 26) AS PayDate
    FROM YourTable

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

Similar Threads

  1. Replies: 1
    Last Post: 10-12-2017, 07:19 PM
  2. Creating ID of Date and Name on Form
    By raychow22 in forum Forms
    Replies: 5
    Last Post: 07-06-2017, 06:04 PM
  3. creating weekending date
    By nclemmons in forum Access
    Replies: 4
    Last Post: 05-01-2015, 09:20 AM
  4. Creating Last Run Date for Reports
    By housmand in forum Reports
    Replies: 17
    Last Post: 06-03-2014, 09:37 AM
  5. Creating a query not between 2 date fields
    By daz2932 in forum Access
    Replies: 3
    Last Post: 08-18-2011, 01:39 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