Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Date Formula

Discussion in 'Information Technology' started by GOL, Nov 15, 2005.

Tags:
  1. GOL

    GOL
    Expand Collapse
    Guest

    I have the following formula in a query:

    Between NZ([Forms]![ReportForm]![txt1st],#10/11/2004#) And
    NZ([Forms]![ReportForm]![txt2nd],Date())

    Instead of having #10/11/2004# as default date, I would like it to simply
    search for the earliest date entered in that field and start from it.
    Basically, I need the opposite of the Date() funciton, I need the earliest
    date to automatically calculate if nothing is put into the text field.
    Everything will be included this way. Does anyone know the formula command?
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Unless you have dates more than 105 years ago, you could use:
    Nz([Forms]![ReportForm]![txt1st], #1/1/1900#)

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "GOL" <GOL@discussions.microsoft.com> wrote in message
    news:CEE55D7A-7316-4F65-A562-E08CD0B8596F@microsoft.com...
    >I have the following formula in a query:
    >
    > Between NZ([Forms]![ReportForm]![txt1st],#10/11/2004#) And
    > NZ([Forms]![ReportForm]![txt2nd],Date())
    >
    > Instead of having #10/11/2004# as default date, I would like it to simply
    > search for the earliest date entered in that field and start from it.
    > Basically, I need the opposite of the Date() funciton, I need the earliest
    > date to automatically calculate if nothing is put into the text field.
    > Everything will be included this way. Does anyone know the formula
    > command?
     
  4. Ofer

    Ofer
    Expand Collapse
    Guest

    Try using the Dmin

    Between NZ([Forms]![ReportForm]![txt1st],DMin("[DateField]","[TableName]"))
    And NZ([Forms]![ReportForm]![txt2nd],Date())

    But I would enter a fix date, as you did, that I know that you can't have
    any earlier date then that, so the query will be faster.

    --
    I hope that helped
    Good Luck


    "GOL" wrote:

    > I have the following formula in a query:
    >
    > Between NZ([Forms]![ReportForm]![txt1st],#10/11/2004#) And
    > NZ([Forms]![ReportForm]![txt2nd],Date())
    >
    > Instead of having #10/11/2004# as default date, I would like it to simply
    > search for the earliest date entered in that field and start from it.
    > Basically, I need the opposite of the Date() funciton, I need the earliest
    > date to automatically calculate if nothing is put into the text field.
    > Everything will be included this way. Does anyone know the formula command?
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page