Results 1 to 4 of 4
  1. #1
    hank711 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    2

    Auto populate last day on month in one field based upon date in another field

    Example: I have a field [txt_StartCurrent] with a date of 1/1/2020. I want to have another field [txt_EndCurrent] auto populate with last day of the month for the date in [txt_StartCurrent] (should result in 1/31/2020). I first tried the following:



    =DateAdd('m',1,[txt_StartCurrent]))

    for this example it populates the field with 2/1/2020. I also tried:

    =DateAdd("d",-1,DateSerial(Year(Date()),Month(Date())+1,1))

    This populates with the last day of the month but is based on the current date and not the date in the [txt_StartCurrent] field. How can I write this expression to have it reference the [txt_StartCurrent] field and not the current date?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,739
    Try replacing Date() with [txt_StartCurrent]
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    "Everyone has a photographic memory; some just don't have film." Steven Wright

  3. #3
    hank711 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    2
    How did I not see that??? Micron...thank you so much! Much appreciated!!!

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,739
    No problem. Glad to have been able to help. Please mark your thread as solved if you're done with it.

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

Similar Threads

  1. Replies: 5
    Last Post: 07-06-2018, 01:30 PM
  2. Replies: 2
    Last Post: 12-20-2016, 08:55 AM
  3. Replies: 2
    Last Post: 07-07-2014, 09:19 AM
  4. Replies: 7
    Last Post: 11-28-2012, 01:41 PM
  5. Replies: 3
    Last Post: 10-03-2011, 02:33 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
  •  
Tech Forums: Microsoft Office Forums