Results 1 to 2 of 2

Thread: DCount

  1. #1
    Join Date
    Apr 2004

    Unanswered: DCount

    I am trying to get the DCount function to work!!

    I have a form that has a textbox named Personnel. This displays employee numbers(Unique) driven by a query. On the click of a button the employee number gets sent to the Results Table.

    I want to be albe to know how many occurance of that unique employee number are in the results table for each emp number. I have tried the following code in a Text box on my form and the result is that it's counting the total number of employee numbers in the table. It does not seem to be picking up the unique employee number form the text box.

    Many thanks for any Help

    =DCount("[Personnel]","Results"," [Personnel] = [Personnel]")

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    You're passing the literal string "[Personnel]" which is being translated into the personnel field in the query. Basically you've said "Return everything where 1=1". Break the string after the = and reference your control instead.

    =DCount("[Personnel]","Results"," [Personnel] = '" & [Personnel] & "'")

Posting Permissions

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