Andy Lacey
andy at minstersystems.co.uk
Wed May 12 02:02:31 CDT 2004
Hi Darren I think you need both of Stephen's suggestions. Try this: intX = DCount("[OffenceDate]", "tblOffences", "[OffenceDate] = #" & Format(Me!txtOffenceDate,"mm/dd/yy") & "#") Have a great day. SYWWE -- Andy Lacey http://www.minstersystems.co.uk > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK > Sent: 12 May 2004 06:07 > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] A2K: Can't Get DCount to work > > > Thanks for the reply Stephen > No joy on the Hash character :-(( > > The date format doesn't change it either > > <sigh> > > ----- Original Message ----- > From: "Stephen Bond" <stephen at bondsoftware.co.nz> > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > Sent: Wednesday, May 12, 2004 2:58 PM > Subject: RE: [AccessD] A2K: Can't Get DCount to work > > > > 1. Surround the date with the hash sign (#). > > so, "[OffenceDate] = #" & Me!txtOffenceDate) & "#" > > 2. The other thing that comes to mind, and this > > is off the top of my head, is that some expressions > > require dates to be in US format, so you may have > > to do this to Format(Me!txtOffenceDate),"mm/dd/yyyy") > > > > This might apply to SQL sattements only, can't remember > > > > Stephen Bond > > NZ > > > > > -----Original Message----- > > > From: Darren DICK [mailto:d.dick at uws.edu.au] > > > Sent: Wednesday, 12 May 2004 3:56 p.m. > > > To: AccessD List > > > Subject: [AccessD] A2K: Can't Get DCount to work > > > > > > > > > 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 > > > > > > -- > > > _______________________________________________ > > > AccessD mailing list > > > AccessD at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > > > > -- > > _______________________________________________ > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/a> ccessd > Website: > http://www.databaseadvisors.com > >