[AccessD] A2K: Can't Get DCount to work

Darren DICK d.dick at uws.edu.au
Tue May 11 22:56:27 CDT 2004


Hello all
Can anyone tell me what I am doing wrong here?
I am trying to use dcount to determine how many occurrence of a particular date appear in a table
In my test table there are 8 records with the date 11/05/2004 
So... In my code below,  Msgbox intX should show 8 but it keeps showing 0 (Zero)

Dim intX As integer
intX = DCount("[OffenceDate]", "tblOffences", "[OffenceDate] = " & Me!txtOffenceDate)
MsgBox intX

The table tblOffences is an existing table
the field OffenceDate is an existing field Data Type:Date/Time  formatted dd/mm/yyyy
The control on my form txtOffenceDate is an existing control (formatted dd/mm/yyyy)

I have checked spelling of field names many times and have even copied and pasted
the field names to guarantee spelling.

I have turned 'on and off' the formatting in various combinations.

Just can't get it to work

Any suggestions?

Many thanks

Darren




More information about the AccessD mailing list