where DATE is BETWEEN startdate and enddate...how?

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default where DATE is BETWEEN startdate and enddate...how?

    Hi,

    I need a little help with a SELECT statement.

    I have an events table in an Access db. The events have a start date and an
    end date.

    What statement do I need to show events that occur:

    i. on or after the event start date
    ii. on or before the event end date, but NOT prior to the start date

    In Access I have got a simple query that shows me everything that happens on
    or after "today" which looks like this:

    Field: eventstartdate
    Criteria: >=Now()-1

    I know it must be some kind of "between" command....!
    Any help would be greatly appreciated. Thanks.

    Nath.


    Nathon Jones Guest

  2. Similar Questions and Discussions

    1. JSObject returns wrong date. How can Iextract correct date from digital signature?
      I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and...
    2. #39245 [NEW]: date function generate wrong date with 1162083600 timestamp
      From: lohner at aldea dot hu Operating system: Linux PHP version: 5.1.6 PHP Bug Type: Date/time related Bug description: ...
    3. HIDE IF startdate is the same as enddate
      Hi again, I have the following code on my page. I am trying to hide the "eventenddate" if it is the same as the eventdate. <%IF...
    4. HowTo Select an ID where a "Date" is between startDate and endDate?
      Hello, I have this table ID startDate endDate ------------------------------- 1 04/01/2003 07/30/2003 2 08/01/2003 09/30/2003...
  3. #2

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    WHERE Now() BETWEEN eventStart AND eventEnd

    "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    news:d0hsi2$cs7$1@forums.macromedia.com...
    > Hi,
    >
    > I need a little help with a SELECT statement.
    >
    > I have an events table in an Access db. The events have a start date and
    an
    > end date.
    >
    > What statement do I need to show events that occur:
    >
    > i. on or after the event start date
    > ii. on or before the event end date, but NOT prior to the start date
    >
    > In Access I have got a simple query that shows me everything that happens
    on
    > or after "today" which looks like this:
    >
    > Field: eventstartdate
    > Criteria: >=Now()-1
    >
    > I know it must be some kind of "between" command....!
    > Any help would be greatly appreciated. Thanks.
    >
    > Nath.
    >
    >

    CMBergin Guest

  4. #3

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Hi again CM!

    In Access, in order to show events that happen "today" I have to put:

    WHERE eventdate >=Now()-1

    Do you know why that is? I notice, in your reply, that you have excluded
    that.

    Thanks for all your help. Much appreciated.
    Nath.

    "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    news:d0htrt$f3i$1@forums.macromedia.com...
    > WHERE Now() BETWEEN eventStart AND eventEnd
    >
    > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > news:d0hsi2$cs7$1@forums.macromedia.com...
    >> Hi,
    >>
    >> I need a little help with a SELECT statement.
    >>
    >> I have an events table in an Access db. The events have a start date and
    > an
    >> end date.
    >>
    >> What statement do I need to show events that occur:
    >>
    >> i. on or after the event start date
    >> ii. on or before the event end date, but NOT prior to the start date
    >>
    >> In Access I have got a simple query that shows me everything that happens
    > on
    >> or after "today" which looks like this:
    >>
    >> Field: eventstartdate
    >> Criteria: >=Now()-1
    >>
    >> I know it must be some kind of "between" command....!
    >> Any help would be greatly appreciated. Thanks.
    >>
    >> Nath.
    >>
    >>
    >
    >

    Nathon Jones Guest

  5. #4

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Now returns date as well as time. If you just have a date in your database,
    then it's considered that day at midnight. So if you have >= Now() today at
    3pm, then an even listed in the database as today (no time) takes place at
    midnight.
    '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.

    My comparison goes in the opposite order, so you don't have to worry about
    it.
    '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work since 3pm is
    after midnight. You may have to add 1 to the end date depending on how you
    want the display to work. Not adding 1 - event disappears on the end date.
    Adding 1 - shows on the end date, but not after.

    "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    news:d0hva7$hek$1@forums.macromedia.com...
    > Hi again CM!
    >
    > In Access, in order to show events that happen "today" I have to put:
    >
    > WHERE eventdate >=Now()-1
    >
    > Do you know why that is? I notice, in your reply, that you have excluded
    > that.
    >
    > Thanks for all your help. Much appreciated.
    > Nath.
    >
    > "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > news:d0htrt$f3i$1@forums.macromedia.com...
    > > WHERE Now() BETWEEN eventStart AND eventEnd
    > >
    > > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > > news:d0hsi2$cs7$1@forums.macromedia.com...
    > >> Hi,
    > >>
    > >> I need a little help with a SELECT statement.
    > >>
    > >> I have an events table in an Access db. The events have a start date
    and
    > > an
    > >> end date.
    > >>
    > >> What statement do I need to show events that occur:
    > >>
    > >> i. on or after the event start date
    > >> ii. on or before the event end date, but NOT prior to the start date
    > >>
    > >> In Access I have got a simple query that shows me everything that
    happens
    > > on
    > >> or after "today" which looks like this:
    > >>
    > >> Field: eventstartdate
    > >> Criteria: >=Now()-1
    > >>
    > >> I know it must be some kind of "between" command....!
    > >> Any help would be greatly appreciated. Thanks.
    > >>
    > >> Nath.
    > >>
    > >>
    > >
    > >
    >
    >

    CMBergin Guest

  6. #5

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Thank you CM,

    I think I am finally getting somewhere.

    What is the statement required for a "does not equal"?

    startdate (does not equal) enddate?

    I tried = = but that didn't work, then I tried <> but that didn't work
    either.

    Thanks again
    Nath.

    "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    news:d0i0sk$k3o$1@forums.macromedia.com...
    > Now returns date as well as time. If you just have a date in your
    > database,
    > then it's considered that day at midnight. So if you have >= Now() today
    > at
    > 3pm, then an even listed in the database as today (no time) takes place at
    > midnight.
    > '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.
    >
    > My comparison goes in the opposite order, so you don't have to worry about
    > it.
    > '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work since 3pm
    > is
    > after midnight. You may have to add 1 to the end date depending on how
    > you
    > want the display to work. Not adding 1 - event disappears on the end
    > date.
    > Adding 1 - shows on the end date, but not after.
    >
    > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > news:d0hva7$hek$1@forums.macromedia.com...
    >> Hi again CM!
    >>
    >> In Access, in order to show events that happen "today" I have to put:
    >>
    >> WHERE eventdate >=Now()-1
    >>
    >> Do you know why that is? I notice, in your reply, that you have excluded
    >> that.
    >>
    >> Thanks for all your help. Much appreciated.
    >> Nath.
    >>
    >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    >> news:d0htrt$f3i$1@forums.macromedia.com...
    >> > WHERE Now() BETWEEN eventStart AND eventEnd
    >> >
    >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    >> > news:d0hsi2$cs7$1@forums.macromedia.com...
    >> >> Hi,
    >> >>
    >> >> I need a little help with a SELECT statement.
    >> >>
    >> >> I have an events table in an Access db. The events have a start date
    > and
    >> > an
    >> >> end date.
    >> >>
    >> >> What statement do I need to show events that occur:
    >> >>
    >> >> i. on or after the event start date
    >> >> ii. on or before the event end date, but NOT prior to the start date
    >> >>
    >> >> In Access I have got a simple query that shows me everything that
    > happens
    >> > on
    >> >> or after "today" which looks like this:
    >> >>
    >> >> Field: eventstartdate
    >> >> Criteria: >=Now()-1
    >> >>
    >> >> I know it must be some kind of "between" command....!
    >> >> Any help would be greatly appreciated. Thanks.
    >> >>
    >> >> Nath.
    >> >>
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >

    Nathon Jones Guest

  7. #6

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    For Access, it's <>. Something else is tripping up the query.


    "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    news:d0i6hb$o$1@forums.macromedia.com...
    > Thank you CM,
    >
    > I think I am finally getting somewhere.
    >
    > What is the statement required for a "does not equal"?
    >
    > startdate (does not equal) enddate?
    >
    > I tried = = but that didn't work, then I tried <> but that didn't work
    > either.
    >
    > Thanks again
    > Nath.
    >
    > "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > news:d0i0sk$k3o$1@forums.macromedia.com...
    > > Now returns date as well as time. If you just have a date in your
    > > database,
    > > then it's considered that day at midnight. So if you have >= Now()
    today
    > > at
    > > 3pm, then an even listed in the database as today (no time) takes place
    at
    > > midnight.
    > > '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.
    > >
    > > My comparison goes in the opposite order, so you don't have to worry
    about
    > > it.
    > > '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work since
    3pm
    > > is
    > > after midnight. You may have to add 1 to the end date depending on how
    > > you
    > > want the display to work. Not adding 1 - event disappears on the end
    > > date.
    > > Adding 1 - shows on the end date, but not after.
    > >
    > > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > > news:d0hva7$hek$1@forums.macromedia.com...
    > >> Hi again CM!
    > >>
    > >> In Access, in order to show events that happen "today" I have to put:
    > >>
    > >> WHERE eventdate >=Now()-1
    > >>
    > >> Do you know why that is? I notice, in your reply, that you have
    excluded
    > >> that.
    > >>
    > >> Thanks for all your help. Much appreciated.
    > >> Nath.
    > >>
    > >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > >> news:d0htrt$f3i$1@forums.macromedia.com...
    > >> > WHERE Now() BETWEEN eventStart AND eventEnd
    > >> >
    > >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > >> > news:d0hsi2$cs7$1@forums.macromedia.com...
    > >> >> Hi,
    > >> >>
    > >> >> I need a little help with a SELECT statement.
    > >> >>
    > >> >> I have an events table in an Access db. The events have a start
    date
    > > and
    > >> > an
    > >> >> end date.
    > >> >>
    > >> >> What statement do I need to show events that occur:
    > >> >>
    > >> >> i. on or after the event start date
    > >> >> ii. on or before the event end date, but NOT prior to the start
    date
    > >> >>
    > >> >> In Access I have got a simple query that shows me everything that
    > > happens
    > >> > on
    > >> >> or after "today" which looks like this:
    > >> >>
    > >> >> Field: eventstartdate
    > >> >> Criteria: >=Now()-1
    > >> >>
    > >> >> I know it must be some kind of "between" command....!
    > >> >> Any help would be greatly appreciated. Thanks.
    > >> >>
    > >> >> Nath.
    > >> >>
    > >> >>
    > >> >
    > >> >
    > >>
    > >>
    > >
    > >
    >
    >

    CMBergin Guest

  8. #7

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Hi again,

    I have the following code on my page. I am trying to hide the
    "eventenddate" if it is the same as the eventdate.

    <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    "<%=(rsDateMatch.Fields.Item('eventdate').Value)%> " Then%>
    - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1, 2057)
    %><br>
    <%End IF%>

    The above is giving me:
    Microsoft VBScript compilation (0x800A0409)
    Unterminated string constant

    So I tried:

    <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    "(rsDateMatch.Fields.Item('eventdate').Value)" Then%>
    - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1, 2057)
    %><br>
    <%End IF%>

    But this is showing me both the start date and the end date, even if they
    are the same.

    Hope you can help.
    Nath.


    "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    news:d0i7e5$1gh$1@forums.macromedia.com...
    > For Access, it's <>. Something else is tripping up the query.
    >
    >
    > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > news:d0i6hb$o$1@forums.macromedia.com...
    >> Thank you CM,
    >>
    >> I think I am finally getting somewhere.
    >>
    >> What is the statement required for a "does not equal"?
    >>
    >> startdate (does not equal) enddate?
    >>
    >> I tried = = but that didn't work, then I tried <> but that didn't work
    >> either.
    >>
    >> Thanks again
    >> Nath.
    >>
    >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    >> news:d0i0sk$k3o$1@forums.macromedia.com...
    >> > Now returns date as well as time. If you just have a date in your
    >> > database,
    >> > then it's considered that day at midnight. So if you have >= Now()
    > today
    >> > at
    >> > 3pm, then an even listed in the database as today (no time) takes place
    > at
    >> > midnight.
    >> > '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.
    >> >
    >> > My comparison goes in the opposite order, so you don't have to worry
    > about
    >> > it.
    >> > '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work since
    > 3pm
    >> > is
    >> > after midnight. You may have to add 1 to the end date depending on how
    >> > you
    >> > want the display to work. Not adding 1 - event disappears on the end
    >> > date.
    >> > Adding 1 - shows on the end date, but not after.
    >> >
    >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    >> > news:d0hva7$hek$1@forums.macromedia.com...
    >> >> Hi again CM!
    >> >>
    >> >> In Access, in order to show events that happen "today" I have to put:
    >> >>
    >> >> WHERE eventdate >=Now()-1
    >> >>
    >> >> Do you know why that is? I notice, in your reply, that you have
    > excluded
    >> >> that.
    >> >>
    >> >> Thanks for all your help. Much appreciated.
    >> >> Nath.
    >> >>
    >> >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    >> >> news:d0htrt$f3i$1@forums.macromedia.com...
    >> >> > WHERE Now() BETWEEN eventStart AND eventEnd
    >> >> >
    >> >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    >> >> > news:d0hsi2$cs7$1@forums.macromedia.com...
    >> >> >> Hi,
    >> >> >>
    >> >> >> I need a little help with a SELECT statement.
    >> >> >>
    >> >> >> I have an events table in an Access db. The events have a start
    > date
    >> > and
    >> >> > an
    >> >> >> end date.
    >> >> >>
    >> >> >> What statement do I need to show events that occur:
    >> >> >>
    >> >> >> i. on or after the event start date
    >> >> >> ii. on or before the event end date, but NOT prior to the start
    > date
    >> >> >>
    >> >> >> In Access I have got a simple query that shows me everything that
    >> > happens
    >> >> > on
    >> >> >> or after "today" which looks like this:
    >> >> >>
    >> >> >> Field: eventstartdate
    >> >> >> Criteria: >=Now()-1
    >> >> >>
    >> >> >> I know it must be some kind of "between" command....!
    >> >> >> Any help would be greatly appreciated. Thanks.
    >> >> >>
    >> >> >> Nath.
    >> >> >>
    >> >> >>
    >> >> >
    >> >> >
    >> >>
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >

    Nathon Jones Guest

  9. #8

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Yeah, too many strings and not enough values. :)
    <% %> denotes a script block. Once you've opened a script block, you don't
    need to open another. You're already on the server.

    <%
    If rsDateMatch.Fields.Item("eventenddate").value <>
    rsDateMatch.Fields.Item("eventdate").Value) Then

    Response.Write(DoDateTime((rsDateMatch.Fields.Item ("eventenddate").Value),1,
    2057) & "<br>")
    End If
    %>

    <%= %> is nothing more than a shortcut for <%Response.Write()%>

    "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    news:d0jtpe$fqh$1@forums.macromedia.com...
    > Hi again,
    >
    > I have the following code on my page. I am trying to hide the
    > "eventenddate" if it is the same as the eventdate.
    >
    > <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    > "<%=(rsDateMatch.Fields.Item('eventdate').Value)%> " Then%>
    > - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    2057)
    > %><br>
    > <%End IF%>
    >
    > The above is giving me:
    > Microsoft VBScript compilation (0x800A0409)
    > Unterminated string constant
    >
    > So I tried:
    >
    > <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    > "(rsDateMatch.Fields.Item('eventdate').Value)" Then%>
    > - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    2057)
    > %><br>
    > <%End IF%>
    >
    > But this is showing me both the start date and the end date, even if they
    > are the same.
    >
    > Hope you can help.
    > Nath.
    >
    >
    > "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > news:d0i7e5$1gh$1@forums.macromedia.com...
    > > For Access, it's <>. Something else is tripping up the query.
    > >
    > >
    > > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > > news:d0i6hb$o$1@forums.macromedia.com...
    > >> Thank you CM,
    > >>
    > >> I think I am finally getting somewhere.
    > >>
    > >> What is the statement required for a "does not equal"?
    > >>
    > >> startdate (does not equal) enddate?
    > >>
    > >> I tried = = but that didn't work, then I tried <> but that didn't work
    > >> either.
    > >>
    > >> Thanks again
    > >> Nath.
    > >>
    > >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > >> news:d0i0sk$k3o$1@forums.macromedia.com...
    > >> > Now returns date as well as time. If you just have a date in your
    > >> > database,
    > >> > then it's considered that day at midnight. So if you have >= Now()
    > > today
    > >> > at
    > >> > 3pm, then an even listed in the database as today (no time) takes
    place
    > > at
    > >> > midnight.
    > >> > '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.
    > >> >
    > >> > My comparison goes in the opposite order, so you don't have to worry
    > > about
    > >> > it.
    > >> > '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work since
    > > 3pm
    > >> > is
    > >> > after midnight. You may have to add 1 to the end date depending on
    how
    > >> > you
    > >> > want the display to work. Not adding 1 - event disappears on the end
    > >> > date.
    > >> > Adding 1 - shows on the end date, but not after.
    > >> >
    > >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > >> > news:d0hva7$hek$1@forums.macromedia.com...
    > >> >> Hi again CM!
    > >> >>
    > >> >> In Access, in order to show events that happen "today" I have to
    put:
    > >> >>
    > >> >> WHERE eventdate >=Now()-1
    > >> >>
    > >> >> Do you know why that is? I notice, in your reply, that you have
    > > excluded
    > >> >> that.
    > >> >>
    > >> >> Thanks for all your help. Much appreciated.
    > >> >> Nath.
    > >> >>
    > >> >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > >> >> news:d0htrt$f3i$1@forums.macromedia.com...
    > >> >> > WHERE Now() BETWEEN eventStart AND eventEnd
    > >> >> >
    > >> >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > >> >> > news:d0hsi2$cs7$1@forums.macromedia.com...
    > >> >> >> Hi,
    > >> >> >>
    > >> >> >> I need a little help with a SELECT statement.
    > >> >> >>
    > >> >> >> I have an events table in an Access db. The events have a start
    > > date
    > >> > and
    > >> >> > an
    > >> >> >> end date.
    > >> >> >>
    > >> >> >> What statement do I need to show events that occur:
    > >> >> >>
    > >> >> >> i. on or after the event start date
    > >> >> >> ii. on or before the event end date, but NOT prior to the start
    > > date
    > >> >> >>
    > >> >> >> In Access I have got a simple query that shows me everything that
    > >> > happens
    > >> >> > on
    > >> >> >> or after "today" which looks like this:
    > >> >> >>
    > >> >> >> Field: eventstartdate
    > >> >> >> Criteria: >=Now()-1
    > >> >> >>
    > >> >> >> I know it must be some kind of "between" command....!
    > >> >> >> Any help would be greatly appreciated. Thanks.
    > >> >> >>
    > >> >> >> Nath.
    > >> >> >>
    > >> >> >>
    > >> >> >
    > >> >> >
    > >> >>
    > >> >>
    > >> >
    > >> >
    > >>
    > >>
    > >
    > >
    >
    >

    CMBergin Guest

  10. #9

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Thanks CM,

    I tried this:

    <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    (rsDateMatch.Fields.Item("eventdate").Value) Then%>
    - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1, 2057)
    %>
    <%End IF%>

    And it works a treat. Thanks for all your help.

    Nath.

    "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    news:d0k8jb$2s6$1@forums.macromedia.com...
    > Yeah, too many strings and not enough values. :)
    > <% %> denotes a script block. Once you've opened a script block, you
    > don't
    > need to open another. You're already on the server.
    >
    > <%
    > If rsDateMatch.Fields.Item("eventenddate").value <>
    > rsDateMatch.Fields.Item("eventdate").Value) Then
    >
    > Response.Write(DoDateTime((rsDateMatch.Fields.Item ("eventenddate").Value),1,
    > 2057) & "<br>")
    > End If
    > %>
    >
    > <%= %> is nothing more than a shortcut for <%Response.Write()%>
    >
    > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > news:d0jtpe$fqh$1@forums.macromedia.com...
    >> Hi again,
    >>
    >> I have the following code on my page. I am trying to hide the
    >> "eventenddate" if it is the same as the eventdate.
    >>
    >> <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    >> "<%=(rsDateMatch.Fields.Item('eventdate').Value)%> " Then%>
    >> - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    > 2057)
    >> %><br>
    >> <%End IF%>
    >>
    >> The above is giving me:
    >> Microsoft VBScript compilation (0x800A0409)
    >> Unterminated string constant
    >>
    >> So I tried:
    >>
    >> <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    >> "(rsDateMatch.Fields.Item('eventdate').Value)" Then%>
    >> - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    > 2057)
    >> %><br>
    >> <%End IF%>
    >>
    >> But this is showing me both the start date and the end date, even if they
    >> are the same.
    >>
    >> Hope you can help.
    >> Nath.
    >>
    >>
    >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    >> news:d0i7e5$1gh$1@forums.macromedia.com...
    >> > For Access, it's <>. Something else is tripping up the query.
    >> >
    >> >
    >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    >> > news:d0i6hb$o$1@forums.macromedia.com...
    >> >> Thank you CM,
    >> >>
    >> >> I think I am finally getting somewhere.
    >> >>
    >> >> What is the statement required for a "does not equal"?
    >> >>
    >> >> startdate (does not equal) enddate?
    >> >>
    >> >> I tried = = but that didn't work, then I tried <> but that didn't work
    >> >> either.
    >> >>
    >> >> Thanks again
    >> >> Nath.
    >> >>
    >> >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    >> >> news:d0i0sk$k3o$1@forums.macromedia.com...
    >> >> > Now returns date as well as time. If you just have a date in your
    >> >> > database,
    >> >> > then it's considered that day at midnight. So if you have >= Now()
    >> > today
    >> >> > at
    >> >> > 3pm, then an even listed in the database as today (no time) takes
    > place
    >> > at
    >> >> > midnight.
    >> >> > '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.
    >> >> >
    >> >> > My comparison goes in the opposite order, so you don't have to worry
    >> > about
    >> >> > it.
    >> >> > '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work
    >> >> > since
    >> > 3pm
    >> >> > is
    >> >> > after midnight. You may have to add 1 to the end date depending on
    > how
    >> >> > you
    >> >> > want the display to work. Not adding 1 - event disappears on the
    >> >> > end
    >> >> > date.
    >> >> > Adding 1 - shows on the end date, but not after.
    >> >> >
    >> >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    >> >> > news:d0hva7$hek$1@forums.macromedia.com...
    >> >> >> Hi again CM!
    >> >> >>
    >> >> >> In Access, in order to show events that happen "today" I have to
    > put:
    >> >> >>
    >> >> >> WHERE eventdate >=Now()-1
    >> >> >>
    >> >> >> Do you know why that is? I notice, in your reply, that you have
    >> > excluded
    >> >> >> that.
    >> >> >>
    >> >> >> Thanks for all your help. Much appreciated.
    >> >> >> Nath.
    >> >> >>
    >> >> >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    >> >> >> news:d0htrt$f3i$1@forums.macromedia.com...
    >> >> >> > WHERE Now() BETWEEN eventStart AND eventEnd
    >> >> >> >
    >> >> >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    >> >> >> > news:d0hsi2$cs7$1@forums.macromedia.com...
    >> >> >> >> Hi,
    >> >> >> >>
    >> >> >> >> I need a little help with a SELECT statement.
    >> >> >> >>
    >> >> >> >> I have an events table in an Access db. The events have a start
    >> > date
    >> >> > and
    >> >> >> > an
    >> >> >> >> end date.
    >> >> >> >>
    >> >> >> >> What statement do I need to show events that occur:
    >> >> >> >>
    >> >> >> >> i. on or after the event start date
    >> >> >> >> ii. on or before the event end date, but NOT prior to the start
    >> > date
    >> >> >> >>
    >> >> >> >> In Access I have got a simple query that shows me everything
    >> >> >> >> that
    >> >> > happens
    >> >> >> > on
    >> >> >> >> or after "today" which looks like this:
    >> >> >> >>
    >> >> >> >> Field: eventstartdate
    >> >> >> >> Criteria: >=Now()-1
    >> >> >> >>
    >> >> >> >> I know it must be some kind of "between" command....!
    >> >> >> >> Any help would be greatly appreciated. Thanks.
    >> >> >> >>
    >> >> >> >> Nath.
    >> >> >> >>
    >> >> >> >>
    >> >> >> >
    >> >> >> >
    >> >> >>
    >> >> >>
    >> >> >
    >> >> >
    >> >>
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >

    Nathon Jones Guest

  11. #10

    Default Re: where DATE is BETWEEN startdate and enddate...how?

    Same thing, just more typing. :)
    Glad everything's working for you.

    "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    news:d0k8pu$35b$1@forums.macromedia.com...
    > Thanks CM,
    >
    > I tried this:
    >
    > <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    > (rsDateMatch.Fields.Item("eventdate").Value) Then%>
    > - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    2057)
    > %>
    > <%End IF%>
    >
    > And it works a treat. Thanks for all your help.
    >
    > Nath.
    >
    > "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > news:d0k8jb$2s6$1@forums.macromedia.com...
    > > Yeah, too many strings and not enough values. :)
    > > <% %> denotes a script block. Once you've opened a script block, you
    > > don't
    > > need to open another. You're already on the server.
    > >
    > > <%
    > > If rsDateMatch.Fields.Item("eventenddate").value <>
    > > rsDateMatch.Fields.Item("eventdate").Value) Then
    > >
    > >
    Response.Write(DoDateTime((rsDateMatch.Fields.Item ("eventenddate").Value),1,
    > > 2057) & "<br>")
    > > End If
    > > %>
    > >
    > > <%= %> is nothing more than a shortcut for <%Response.Write()%>
    > >
    > > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > > news:d0jtpe$fqh$1@forums.macromedia.com...
    > >> Hi again,
    > >>
    > >> I have the following code on my page. I am trying to hide the
    > >> "eventenddate" if it is the same as the eventdate.
    > >>
    > >> <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    > >> "<%=(rsDateMatch.Fields.Item('eventdate').Value)%> " Then%>
    > >> - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    > > 2057)
    > >> %><br>
    > >> <%End IF%>
    > >>
    > >> The above is giving me:
    > >> Microsoft VBScript compilation (0x800A0409)
    > >> Unterminated string constant
    > >>
    > >> So I tried:
    > >>
    > >> <%IF (rsDateMatch.Fields.Item("eventenddate").Value) <>
    > >> "(rsDateMatch.Fields.Item('eventdate').Value)" Then%>
    > >> - <%= DoDateTime((rsDateMatch.Fields.Item("eventenddate" ).Value), 1,
    > > 2057)
    > >> %><br>
    > >> <%End IF%>
    > >>
    > >> But this is showing me both the start date and the end date, even if
    they
    > >> are the same.
    > >>
    > >> Hope you can help.
    > >> Nath.
    > >>
    > >>
    > >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > >> news:d0i7e5$1gh$1@forums.macromedia.com...
    > >> > For Access, it's <>. Something else is tripping up the query.
    > >> >
    > >> >
    > >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > >> > news:d0i6hb$o$1@forums.macromedia.com...
    > >> >> Thank you CM,
    > >> >>
    > >> >> I think I am finally getting somewhere.
    > >> >>
    > >> >> What is the statement required for a "does not equal"?
    > >> >>
    > >> >> startdate (does not equal) enddate?
    > >> >>
    > >> >> I tried = = but that didn't work, then I tried <> but that didn't
    work
    > >> >> either.
    > >> >>
    > >> >> Thanks again
    > >> >> Nath.
    > >> >>
    > >> >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > >> >> news:d0i0sk$k3o$1@forums.macromedia.com...
    > >> >> > Now returns date as well as time. If you just have a date in your
    > >> >> > database,
    > >> >> > then it's considered that day at midnight. So if you have >=
    Now()
    > >> > today
    > >> >> > at
    > >> >> > 3pm, then an even listed in the database as today (no time) takes
    > > place
    > >> > at
    > >> >> > midnight.
    > >> >> > '3/6/2005' < '3/6/2005 15:00:00', so you don't get any events.
    > >> >> >
    > >> >> > My comparison goes in the opposite order, so you don't have to
    worry
    > >> > about
    > >> >> > it.
    > >> >> > '3/6/2005 15:00:00' BETWEEN '3/6/2005' AND '3/7/3005' will work
    > >> >> > since
    > >> > 3pm
    > >> >> > is
    > >> >> > after midnight. You may have to add 1 to the end date depending
    on
    > > how
    > >> >> > you
    > >> >> > want the display to work. Not adding 1 - event disappears on the
    > >> >> > end
    > >> >> > date.
    > >> >> > Adding 1 - shows on the end date, but not after.
    > >> >> >
    > >> >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > >> >> > news:d0hva7$hek$1@forums.macromedia.com...
    > >> >> >> Hi again CM!
    > >> >> >>
    > >> >> >> In Access, in order to show events that happen "today" I have to
    > > put:
    > >> >> >>
    > >> >> >> WHERE eventdate >=Now()-1
    > >> >> >>
    > >> >> >> Do you know why that is? I notice, in your reply, that you have
    > >> > excluded
    > >> >> >> that.
    > >> >> >>
    > >> >> >> Thanks for all your help. Much appreciated.
    > >> >> >> Nath.
    > >> >> >>
    > >> >> >> "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > >> >> >> news:d0htrt$f3i$1@forums.macromedia.com...
    > >> >> >> > WHERE Now() BETWEEN eventStart AND eventEnd
    > >> >> >> >
    > >> >> >> > "Nathon Jones" <nathonjonesNOT@kirkmoor.com> wrote in message
    > >> >> >> > news:d0hsi2$cs7$1@forums.macromedia.com...
    > >> >> >> >> Hi,
    > >> >> >> >>
    > >> >> >> >> I need a little help with a SELECT statement.
    > >> >> >> >>
    > >> >> >> >> I have an events table in an Access db. The events have a
    start
    > >> > date
    > >> >> > and
    > >> >> >> > an
    > >> >> >> >> end date.
    > >> >> >> >>
    > >> >> >> >> What statement do I need to show events that occur:
    > >> >> >> >>
    > >> >> >> >> i. on or after the event start date
    > >> >> >> >> ii. on or before the event end date, but NOT prior to the
    start
    > >> > date
    > >> >> >> >>
    > >> >> >> >> In Access I have got a simple query that shows me everything
    > >> >> >> >> that
    > >> >> > happens
    > >> >> >> > on
    > >> >> >> >> or after "today" which looks like this:
    > >> >> >> >>
    > >> >> >> >> Field: eventstartdate
    > >> >> >> >> Criteria: >=Now()-1
    > >> >> >> >>
    > >> >> >> >> I know it must be some kind of "between" command....!
    > >> >> >> >> Any help would be greatly appreciated. Thanks.
    > >> >> >> >>
    > >> >> >> >> Nath.
    > >> >> >> >>
    > >> >> >> >>
    > >> >> >> >
    > >> >> >> >
    > >> >> >>
    > >> >> >>
    > >> >> >
    > >> >> >
    > >> >>
    > >> >>
    > >> >
    > >> >
    > >>
    > >>
    > >
    > >
    >
    >

    CMBergin Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139