Re: more dates!!!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

gmpurple_at_yahoo.com
Date: 05/25/04

  • Next message: AHopper: "Re: Count Unique Values"
    Date: Tue, 25 May 2004 13:10:00 -0700
    
    

    No the fields aren't what I'm checking for as NULL. The
    user enters a start date and and end date through a form,
    and they have the option to leave either of those blank.
    That is where I'm stuck.

    >-----Original Message-----
    >Hi,
    >
    >
    > Who is NULL? I assumed, up to now, it was FORMS!...
    that were, but if
    >the field name "calculatedFromDate"
    or "calculatedToDate" is the
    >potential NULL value, then, indeed, you have
    to "decorate" them with a Nz
    >too:
    >
    >WHERE ( Nz(calculatedFromDate, Date() ) BETWEEN ...
    AND ... )
    > AND ( Nz(calculatedToDate, Date() ) BETWEEN ...
    AND ... )
    >
    >
    >
    >Hoping it may help,
    >Vanderghast, Access MVP
    >
    >
    ><anonymous@discussions.microsoft.com> wrote in message
    >news:1220401c44284$84d0f6e0$a601280a@phx.gbl...
    >> I completely understand and appreciate your suggestion.
    >> It makes sense to me. However, when I use the code so
    it
    >> appears as:
    >>
    >> WHERE ((([calculated dates].calculatedFromDate)
    Between Nz
    >> (Nz([Forms]![range]![start],[Forms]![range]![end]),Date
    >> ()) And Nz(Nz([Forms]![range]![end],[Forms]![range]!
    >> [start]),Date())) AND (([calculated
    >> dates].calculatedToDate) Between Nz(Nz([Forms]![range]!
    >> [start],[Forms]![range]![end]),Date()) And Nz(Nz
    ([Forms]!
    >> [range]![end],[Forms]![range]![start]),Date())));
    >>
    >> it still doesn't return any values when the start date
    >> and end date are both entered as null. It also doesn't
    >> return any dates when the start date is null and the
    end
    >> date is entered. Did I interperet your advice (which
    >> again I truly appreciate)?
    >> >-----Original Message-----
    >> >Hi,
    >> >
    >> > It as a much simpler look. :-) Admit it, it
    is a
    >> nice start... but
    >> >more seriously...
    >> >
    >> > Your code seems to fail (accordingly to what you
    >> specify) if start IS
    >> >NULL (and so, I assume, in this case, end field is
    also
    >> a null). Your code
    >> >is somewhat equivalent to:
    >> >
    >> >fromTested >= Nz(start, date() ) AND
    >> >fromTested <= Nz(end, start) AND
    >> >upToTested >= Nz(start, date() ) AND
    >> >upToTested <= Nz(end, start)
    >> >
    >> >
    >> >
    >> > Watch the second and fourth clauses, when start is
    >> null, and probably
    >> >end is also null, once the iif (or Nz) are evaluated,
    >> that gives us:
    >> >
    >> >fromTested >= date() AND
    >> >fromTested <= NULL AND
    >> >upToTested >= date() AND
    >> >upToTested <= NULL
    >> >
    >> >
    >> >which may evaluate, finally, to NULL, or to false (but
    >> NEVER to TRUE). The
    >> >proposed code also replace those NULL by today date,
    in
    >> this scenario (end
    >> >IS NULL, start IS NULL).
    >> >
    >> >The proposed code is a little bit like rewriting the
    >> fourth clause to:
    >> >
    >> >upToTested <= Nz( Nz(end, start) , Date( ) )
    >> >
    >> >as example (and also the second clause should be
    >> submitted to the same
    >> >modification). The proposed code also looks for the
    >> possible (is it?) case
    >> >where start is null and end is not, it then uses end
    >> (first and third
    >> >clause).
    >> >
    >> >
    >> >
    >> >
    >> >Hoping it may help,
    >> >Vanderghast, Access MVP
    >> >
    >> >
    >> >
    >> >
    >> >"brigid" <anonymous@discussions.microsoft.com> wrote
    in
    >> message
    >> >news:11f8c01c44267$b33fe3f0$a301280a@phx.gbl...
    >> >> How is this any different than the current code?
    >> >>
    >> >> >-----Original Message-----
    >> >> >Hi,
    >> >> >
    >> >> >
    >> >> >.... WHERE myField BETWEEN Nz( Nz( StartDate,
    >> EndDate),
    >> >> date() )
    >> >> > AND Nz( Nz( EndDate, StartDate), date() )
    >> >> >
    >> >> >Hoping it may help,
    >> >> >Vanderghast, Access MVP
    >> >> >
    >> >> >
    >> >> >
    >> >> >"brigid" <gmpurple@yahoo.com> wrote in message
    >> >> >news:1048d01c43f4b$322b4490$a101280a@phx.gbl...
    >> >> >> The user inputs a start date and an end date in a
    >> form,
    >> >> >> and the query displays data in between those 2
    >> dates.
    >> >> If
    >> >> >> the user enters a start date but no end date, by
    >> >> default
    >> >> >> the end date = start date and therefore that
    day's
    >> data
    >> >> >> is displayed. If the user enters an end date
    but no
    >> >> >> start date, by default the start date = today's
    >> date,
    >> >> and
    >> >> >> therefore data for today's date through the end
    >> date is
    >> >> >> displayed. However, if the user leaves both
    dates
    >> >> blank,
    >> >> >> I would like both dates to default to today's
    date.
    >> >> >> However, no data whatsoever is being displayed.
    I
    >> >> don't
    >> >> >> understand why because the start date should be
    >> >> defaulted
    >> >> >> to today's, and when the end date is null it
    looks
    >> to
    >> >> the
    >> >> >> start date. The code is as follows:
    >> >> >>
    >> >> >> SELECT [calculated dates].calculatedFromDate,
    >> >> [calculated
    >> >> >> dates].calculatedToDate, [calculated dates].
    [Blotter
    >> >> >> Entry Date]
    >> >> >> FROM [calculated dates]
    >> >> >> WHERE ((([calculated dates].calculatedFromDate)
    >=IIf
    >> >> >> ([Forms]![range]![start] Is Null,Date(),[Forms]!
    >> >> [range]!
    >> >> >> [start]) And ([calculated
    dates].calculatedFromDate)
    >> >> <=IIf
    >> >> >> ([Forms]![range]![end] Is Null,[Forms]![range]!
    >> [start],
    >> >> >> [Forms]![range]![end])) AND (([calculated
    >> >> >> dates].calculatedToDate)>=IIf([Forms]![range]!
    >> [start]
    >> >> Is
    >> >> >> Null,Date(),[Forms]![range]![start]) And
    >> ([calculated
    >> >> >> dates].calculatedToDate)<=IIf([Forms]![range]!
    [end]
    >> Is
    >> >> >> Null,[Forms]![range]![start],[Forms]![range]!
    >> [end])));
    >> >> >
    >> >> >
    >> >> >.
    >> >> >
    >> >
    >> >
    >> >.
    >> >
    >
    >
    >.
    >


  • Next message: AHopper: "Re: Count Unique Values"

    Relevant Pages

    • Re: should i installed SP 2 in my PC?
      ... > suggestion or advice to help me out. ... using Windows XP "prettifications". ... You should at least turn on the built in firewall. ... My suggestion - upgrade. ...
      (microsoft.public.windowsupdate)
    • Re: Multiple Spyware/Adware applications
      ... > Suite installed, which includes spyware/adware removal. ... If you don't wish to follow all of the advice immediately, ... using Windows XP "prettifications". ... My suggestion - upgrade. ...
      (microsoft.public.windowsxp.security_admin)
    • Re: Champion of Neutrality (Was: Talents)
      ... > And the "don't expect it to do any good" was referring not to the change ... but to the suggestion itself; ... > rejected all of the suggestions and advice I've offered, ... in terms of shifting positions related to IGB. ...
      (rec.games.roguelike.adom)
    • Re: Repost: what is the best free indexing-searching engine ?
      ... My repost is the result of your suggestion: ... My experience in IT tells me that it is better to rely on expert's advice that ... >> I am looking for a free software that would help me to build a search ...
      (alt.internet.search-engines)
    • Re: FP-style map over set
      ... advice on how to implement an algorithm, you have to specify the data structure that you want the algorithm to operate on. ... Or are you also asking for advice on how to implement the set ADT? ...
      (comp.lang.functional)