Results 1 to 8 of 8
  1. #1
    arbucklemw is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    10

    Date calculated based on text field

    I'm trying to figure out if it's possible to have Access calculate a date field based on the contents of a text field and another date. I have done this with Excel with "If/then/or", easy enough, but haven't been able to figure out if it's possible in Access.



    I have 3 possible entries for the text field, CAR, HAZ, PAS.

    I'll have a start date that will be entered by the user.

    I then want Access to calculate a due date field based either 30 or 45 days out from the user entered date, 30 days out if either HAZ or PAS is in the text field being used, and 45 days out if CAR is in the text field for the record.

    Can this be done in Access?

    Or, would it be easier to have a number field associated with each text entry above that represents the 3 options, then have the date calculated using the DateAdd() function somehow?

    Thanks!
    Michael

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Are these business/working days, or calendar days, and does it ignore/process holidays?

    Perhaps (untested)

    dueDate = Dateadd("d",iif(userSelected= "Haz" or userSelected = "Pas",45,30),EnteredDate)

    if Car is the only other option to Haz,Pas

  3. #3
    arbucklemw is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    10
    Straight calendar days, and not ignoring holidays. Every day counts. Thanks!

  4. #4
    arbucklemw is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    10
    Driving myself nuts between Googling this and flipping through The Missing Manual.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  6. #6
    arbucklemw is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    10
    Thanks again!

  7. #7
    arbucklemw is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    10
    One more. How can I have Access pull a date from another field to be used as part of the DateAdd function? I've tried multiple variations of the below with no luck. The field i'm trying to pull the date from is the DateReceived field.

    DateAdd ("d", 30, #[DateReceived]#)

    DateAdd ("d", 30, [DateReceived])

    DateAdd ("d", 30, #DateReceived#)

    and more. No joy.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    If this is on the form you can try Me.DateReceived.

    Or show us a jpg of the form, or post a copy of the database(remove anything personal first)

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

Similar Threads

  1. Replies: 1
    Last Post: 05-22-2017, 05:59 AM
  2. Replies: 1
    Last Post: 03-27-2014, 06:42 AM
  3. Replies: 7
    Last Post: 03-03-2014, 01:36 PM
  4. Replies: 3
    Last Post: 04-01-2012, 01:40 PM
  5. Query Date Range Based on Calculated Fields
    By wilsoa in forum Queries
    Replies: 6
    Last Post: 03-08-2012, 02:41 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