How do you say greater than and not equal to?

  • Follow


I want all the records in the DateRptSubmitted field where the date is later 
than the date in the DateEntered field.  It's a quality control query to 
catch bad dates in the DateRptSubmitted field.  Both fields live in the same 
table.  I don't want to include records where the DateRptSubmitted is the 
same date as the DateEntered, because there's nothing wrong with that.  How 
do you write the criteria for this?  
-- 
Shelly Kendrick
0
Reply Utf 12/6/2007 5:07:03 PM

There is no special syntax for that, because something can never be both 
greater than and equal to something else.  All you need is greater than...



"Shelly Kendrick" wrote:

> I want all the records in the DateRptSubmitted field where the date is later 
> than the date in the DateEntered field.  It's a quality control query to 
> catch bad dates in the DateRptSubmitted field.  Both fields live in the same 
> table.  I don't want to include records where the DateRptSubmitted is the 
> same date as the DateEntered, because there's nothing wrong with that.  How 
> do you write the criteria for this?  
> -- 
> Shelly Kendrick
0
Reply Utf 12/6/2007 6:02:01 PM


But just > is not working.  It's also giving me equal to and I don't want 
equal to.  I suppose I could make a table of the > result and then run a <>= 
query against that table.  I'll do that.  It just seems like there ought to 
be a way to do it with one query.
-- 
Shelly Kendrick


"Lance" wrote:

> There is no special syntax for that, because something can never be both 
> greater than and equal to something else.  All you need is greater than...
> 
> 
> 
> "Shelly Kendrick" wrote:
> 
> > I want all the records in the DateRptSubmitted field where the date is later 
> > than the date in the DateEntered field.  It's a quality control query to 
> > catch bad dates in the DateRptSubmitted field.  Both fields live in the same 
> > table.  I don't want to include records where the DateRptSubmitted is the 
> > same date as the DateEntered, because there's nothing wrong with that.  How 
> > do you write the criteria for this?  
> > -- 
> > Shelly Kendrick
0
Reply Utf 12/6/2007 6:15:04 PM

On Thu, 6 Dec 2007 09:07:03 -0800, Shelly Kendrick
<ShellyKendrick@discussions.microsoft.com> wrote:

>I want all the records in the DateRptSubmitted field where the date is later 
>than the date in the DateEntered field.  It's a quality control query to 
>catch bad dates in the DateRptSubmitted field.  Both fields live in the same 
>table.  I don't want to include records where the DateRptSubmitted is the 
>same date as the DateEntered, because there's nothing wrong with that.  How 
>do you write the criteria for this?  

My guess is that your date field contains a time component. Regardless of how
it's formatted, #12/6/2007 11:25:31am# is in fact greater then #12/6/2007# -
since the pure date value assumes a time of midnight at the beginning of the
day.

Is it possible that the DateRptSubmitted has a time component (e.g. it's being
filled using a default value of Now()) whereas the DateEntered field is just a
pure date? Take a look in the table datasheet, or set the Format of the
textbox (temporarily perhaps) to General Date.

             John W. Vinson [MVP]
0
Reply John 12/6/2007 6:27:39 PM

Oh my goodness, I just had a duh moment.  My query result had yet another 
date field next to the DateRptSubmitted, and the DateEntered field was not 
showing in my result, hence I was comparing the DateRptSubmitted field to the 
wrong date field.  I'm so sorry.  Thank you Lance and John for your wise 
advice!  Lance, you were right, and John, that could potentially be the issue 
for me in the future!  Sorry I'm an idiot -- thank you so so much for your 
feedback!!-- 
Shelly Kendrick


"John W. Vinson" wrote:

> On Thu, 6 Dec 2007 09:07:03 -0800, Shelly Kendrick
> <ShellyKendrick@discussions.microsoft.com> wrote:
> 
> >I want all the records in the DateRptSubmitted field where the date is later 
> >than the date in the DateEntered field.  It's a quality control query to 
> >catch bad dates in the DateRptSubmitted field.  Both fields live in the same 
> >table.  I don't want to include records where the DateRptSubmitted is the 
> >same date as the DateEntered, because there's nothing wrong with that.  How 
> >do you write the criteria for this?  
> 
> My guess is that your date field contains a time component. Regardless of how
> it's formatted, #12/6/2007 11:25:31am# is in fact greater then #12/6/2007# -
> since the pure date value assumes a time of midnight at the beginning of the
> day.
> 
> Is it possible that the DateRptSubmitted has a time component (e.g. it's being
> filled using a default value of Now()) whereas the DateEntered field is just a
> pure date? Take a look in the table datasheet, or set the Format of the
> textbox (temporarily perhaps) to General Date.
> 
>              John W. Vinson [MVP]
> 
0
Reply Utf 12/6/2007 6:44:04 PM

4 Replies
283 Views

(page loaded in 0.104 seconds)


Reply: