Criteria Expression as a date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All:

I have the following two variables in query:

sterm (date format)
rdegree (text format, 1 reprent having obtained a degree and 2 having not
obtained a degree)

sterm means the term our students transferred to a senior college; rdegree
indicates having obtained a degree from that senior college.

Now I want to use Access to report how many students who transferred to a
senior college between 01-Sep-00 to 01-Sep-01 obtained a degree. I wrote the
following expression to count the total:

=Count(IIf('01-Sep-00'<[sterm]<'01-Sep-01', rdegree=1))

When I tried to go to print fomat, I got the following error message:

Data type mismatch in criteria expression.

I am afraid that I cannot use < or > for date variable but what can I do for
this specific problem?

Thanks.


Charles
 
Dates in Access/Jet require "#" as the delimiter.
IIf() should include 3 arguments.
I believe you should use:
=Sum(Abs([sterm]>=#9/1/2000# AND sterm<#9/1/2001# AND rdegree = 1))
 
Hi Duane:

Thank you very much. I think this should work well.


Charles



Duane Hookom said:
Dates in Access/Jet require "#" as the delimiter.
IIf() should include 3 arguments.
I believe you should use:
=Sum(Abs([sterm]>=#9/1/2000# AND sterm<#9/1/2001# AND rdegree = 1))

--
Duane Hookom
MS Access MVP


Charles said:
Hi All:

I have the following two variables in query:

sterm (date format)
rdegree (text format, 1 reprent having obtained a degree and 2 having not
obtained a degree)

sterm means the term our students transferred to a senior college; rdegree
indicates having obtained a degree from that senior college.

Now I want to use Access to report how many students who transferred to a
senior college between 01-Sep-00 to 01-Sep-01 obtained a degree. I wrote
the
following expression to count the total:

=Count(IIf('01-Sep-00'<[sterm]<'01-Sep-01', rdegree=1))

When I tried to go to print fomat, I got the following error message:

Data type mismatch in criteria expression.

I am afraid that I cannot use < or > for date variable but what can I do
for
this specific problem?

Thanks.


Charles
 
Back
Top