Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting the record between two dates (using dcount) 1

Status
Not open for further replies.

rene1000

IS-IT--Management
Apr 9, 2002
89
NL
i am trying to count the amount of records between 1-1-2003 and 31-12-2003 using the dcount command:

inc_jan = DCount(&quot;ID&quot;, &quot;module_IM&quot;, &quot;[Call_date] > #1-1-2003# AND < #31-1-2003#&quot;)

i get the error message &quot;Missing operator in query expression...........&quot;

does anyone know how to resolve this problem ?
 
Hi!

Try either:

[tt]inc_jan = DCount(&quot;ID&quot;, &quot;module_IM&quot;, &quot;[Call_date] > #1-1-2003# AND [Call_date] < #31-12-2003#&quot;)[/tt]

or

[tt]inc_jan = DCount(&quot;ID&quot;, &quot;module_IM&quot;, &quot;[Call_date] between #1-1-2003# AND < #31-12-2003#&quot;)[/tt]

- all on one line

Note - the first one would not include 1 January and 31 of december (amend that using >=, <=).

Note2 - it doesn't seem to make any difference using this function for those dates, but anywhere else where dates are used, and you're system is not not using US date format, you might consider using a US recognizable date, for instance Ansi date: yyyy-mm-dd, in your case 2003-12-31 - see, there might be anomalities when the application is supposed to save or inquire about 10-08-2003 (you meaning 10 august), where it would save or inquire about 8. of october.

HTH Roy-Vidar
 
thanks Roy !

your first solution works great however the second one doesn't. I have now used the >= and <= solution to include 1-1-2003 and 31-1-2003
 
Oups - yes, I seem to have left a &quot;<&quot; in that one, sorry.

Thanx for the star, and nice you've got it working.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top