Welcome to SPN

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

Sign Up Now!

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?
     

Share This Page