Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Aug 2005
    Thanked 0 Times in 0 Posts

    DCount (Access 2000)

    The DCount code i have built to calculate the new customers for the last date somehow is wrong with me.Can you help me ? It is as follows
    ="New Clients : " & DCount("*";"customers";"LastUpdated=DMax(""LastUpd ated"",""customers"")AND afid = 4 ")
    i have attached the example.In the example, on the form, the count of the customers is 0, however this i not true, as one can see from the query, there are 2 new customers, 6481 and 6480.However, my code does not show this.
    Why is it so ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: DCount (Access 2000)

    Because the LastUpdated field contains a time component for many records. You can see this if you set the Format property of LastUpdated to "General Date".

    The result of DMax("LastUpdated","customers") is 29-Nov-2005 13:59:25, but the records you refer to have LastUpdated = 29-Nov-2005 10:22:59 and 29-Nov-2005 10:31:24, so the date parts are equal, but the time parts aren't.

    You could use

    ="New Clients : " & DCount("*","customers","Int(LastUpdated)=Int(DMax( ""LastUpdated"",""customers"")) AND afid = 4")

    The Int function removes the time part.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts