Results 1 to 9 of 9
  1. #1
    ijaz8883 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    103

    Age Calculatre if End Date is missing/Blank it should take today date

    Hi Respected experts!!
    I am facing a problem
    I have a form in which I want to calculate age and I am using said formula:
    =fAge([StartDate],[EndDate])


    But I want to say that If I have blank [EndDate] it should automaticly take it as
    date()as [StartDate] and [EndDate)
    Sometime I have no EndDate then I want that it may calculate it to todate as
    dd/mmm/yy
    Thanks in Advance

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Maybe:
    =fAge([StartDate],Nz(dDate],Date())
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    ijaz8883 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    103
    Quote Originally Posted by Bob Fitz View Post
    Maybe:
    =fAge([StartDate],Nz(dDate],Date())
    =fAge([StartDate],[EndDate])
    =fAge([StartDate],[dDate])
    I have check twice but not working. Its shows error if the field is blank

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    It would probably help to see the code behind fAge()

    What format are your dates in? You may need to US date format.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    232
    Maybe Bob made a typo.
    Try =fAge([StartDate],[Nz(EndDate], Date()))
    Groeten,

    Peter

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by xps35 View Post
    Maybe Bob made a typo.
    Quite right Peter. I let a bracket off when I copy/paste it rom the file I tested in. Should have been:
    =fAge([StartDate],Nz([EndDate], Date()))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    ijaz8883 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    103
    Quote Originally Posted by Bob Fitz View Post
    Quite right Peter. I let a bracket off when I copy/paste it rom the file I tested in. Should have been:
    =fAge([StartDate],Nz([EndDate], Date()))
    Thanks a lot its worked perfect

  8. #8
    ijaz8883 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    103
    Quote Originally Posted by xps35 View Post
    Maybe Bob made a typo.
    Try =fAge([StartDate],[Nz(EndDate], Date()))
    Thanks a lot its worked after little bracket change
    =fAge([StartDate],Nz([EndDate], Date()))

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by ijaz8883 View Post
    Thanks a lot its worked perfect
    Glad you have it working
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 6
    Last Post: 01-16-2022, 04:47 PM
  2. Replies: 2
    Last Post: 03-12-2018, 08:16 AM
  3. Replies: 1
    Last Post: 11-26-2013, 09:25 AM
  4. Replies: 5
    Last Post: 10-12-2012, 11:00 AM
  5. Replies: 12
    Last Post: 04-26-2012, 04:01 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