Results 1 to 5 of 5
  1. #1
    wnicole is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    118

    Date month calculation based on combo box

    I want to set the due date based on a drop down menu/combo box.


    Ex: the length of time product date expiration is based on set list:

    So we have acquired date: 5/1/2013
    Then due in drop down: One month, 3 months, one year, etc

    I need to set the due date automatically based on selection in combo box.
    Does this required an iif statement? Or is there a better way?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, that would require a long nested IIf expression to calculate the due date. If you instead saved the period in months (1, 3, 12) then calculating the due date would be simply DateAdd("m", [Period], [Acquired]).
    You could set up the combobox so users see the descriptor but the months will be saved.
    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
    wnicole is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    118
    Yes I like that idea.
    I will change to numbers that makes it easier thanks june7

  4. #4
    wnicole is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    118
    Everything worked fine...Im using
    =DateSerial(Year([Calibration Date]),Month([Calibration Date])+[Months],Day([Calibration Date]))
    However, when the Date field is null I get this: #Type!

    Anything I can add in this code to maybe just leave blank if date is missing?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why are you using DateSerial instead of just DateAdd? If [Calibration Date] is Null then the expression will return Null.

    = DateAdd("m", [Months], [Calibration Date])
    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.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-26-2013, 03:28 PM
  2. Replies: 2
    Last Post: 03-07-2013, 03:14 PM
  3. Replies: 4
    Last Post: 05-26-2012, 09:29 AM
  4. Replies: 3
    Last Post: 04-01-2012, 01:40 PM
  5. Field content based on date calculation
    By jlmnjem in forum Programming
    Replies: 6
    Last Post: 09-23-2010, 10:24 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