Results 1 to 3 of 3
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Need June 1st date for each year

    Hello everyone! Happy NEW YEAR!



    I have a query that I'm trying to find out the age of an invoice. The invoice is sent once a year. Basically I need this (6/1 stays the same, but I need to change it for the current year.
    Code:
    Age: DateDiff("d",#6/1/2018#,Date())
    Another thing I tried
    Code:
    Age2: GetElapsedDays(#6/1/2018#-Date())
    and then for a third component I have
    Code:
    CurYear: DatePart("yy",Date())
    and I know that it doesn't have to be this difficult! Can anyone point me in the easier direction? I thank you in advance.

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    I don't understand the need for the manual date entry 6/1/yyyy? Do the invoices not have a date field? age would then simply be Age: Date() - InvoiceDateFieldName

    That said I like to use DateSerial() when I'm building a date. DateSerial( year, month, day ) => DateSerial( Year(Date()), 6, 1) would return June 1st of the current year.

  3. #3
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    I got it! And yes kd2017 there is a date field,
    Code:
    SELECT DISTINCTROW Members.MemberID_PK, [dbamount]-[cramount] AS BAL, IIf([SpouseLastName] Is Null And Not ([Spouse] Is Null),[FirstName] & " and " & [Spouse] & " " & [LastName],[FirstName] & " " & [LastName]) AS ComboName, ACTIVEROADSACCOUNTS.DBAmount, ACTIVEROADSACCOUNTS.DBDate, ACTIVEROADSACCOUNTS.Details, ACTIVEROADSACCOUNTS.CRAmount, ACTIVEROADSACCOUNTS.CRDATE, ACTIVEROADSACCOUNTS.COMMENTS, AccountStatus.Status, GetElapsedDays([duedate]-Date()) AS Age2, DateSerial(Year(Date()),6,1) AS Duedate
    FROM (Members INNER JOIN AccountStatus ON Members.MemberID_PK = AccountStatus.MemberID) INNER JOIN ACTIVEROADSACCOUNTS ON Members.MemberID_PK = ACTIVEROADSACCOUNTS.MemberID_PK;

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

Similar Threads

  1. Replies: 7
    Last Post: 06-07-2015, 11:57 PM
  2. Replies: 2
    Last Post: 04-25-2014, 11:33 PM
  3. Replies: 4
    Last Post: 01-09-2013, 11:16 AM
  4. Replies: 4
    Last Post: 01-10-2012, 06:26 PM
  5. July-June Fiscal Year, Not Jan-Dec
    By blazerboy6 in forum Access
    Replies: 2
    Last Post: 04-14-2011, 02:23 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