DCount() Usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ElTipo
    New Member
    • Jul 2007
    • 36

    DCount() Usage

    Here is the real example issue:

    I have a table named [products]. I need to count only one in list.

    [ID] [ProdName] [price]
    1 paper $1.00
    1 paper $1.00
    2 pencil $2.00

    =Dcount([tblproducts],[ID], [ProdNamed]="Papaer") - This is correct? I need to count in the text box report only the paper product. But no work the Dcount to diference count.

    ¿How?

    Thanks for your time. Excuses for my english.
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    Good afternoon, El Tipo,

    Yes this should result in a count of the ID's associated with 'Paper'. Does it work?

    Si, debe funcionar cómo quieres, contando el número de registros de 'Papel'. ¿Funciona?

    ¡Que tengas un buen día!

    Scott

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      The syntax for DCount() using a text criteria is
      Code:
      DCount("[Field Name]", "[TableName]", "Criteria ='string'")
      I could be wrong, but I assume that tblProducts is probably a table name, not a field name, and that ID is a field name, not a table name. I haven't used this in a while, but I believe you'll also have to imclude both the field and table names inside of double quotation marks as well.

      Also, is ProductNamed actually "Papaer" or should it be "Paper?" I only ask becaues of the language difference?

      Linq ;0)>

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32653

        #4
        Linq is absolutely right :)
        • Papaer (or Paper) should be enclosed in SINGLE-quotes (')
        • [tblProducts] & [ID] are in the wrong order
        • ALL the parameters should be enclosed in DOUBLE-quotes

        Code:
        =DCount("[ID]", "[tblproducts]", "[ProdNamed]='Papaer'")

        Comment

        • Scott Price
          Recognized Expert Top Contributor
          • Jul 2007
          • 1384

          #5
          You both are correct :-) Thanks for catching my error... I overlooked the transposition of the table name and field name.

          El Tipo, did you understand what they are saying? ¿Entendiste lo que estan diciendo?

          Regards,
          Scott

          Comment

          Working...