Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    2

    Question Unanswered: Dcount and referencing current record

    Hi I am a newbie and having difficulties with the DCount function.

    I have two forms with corresponding tables: Pol_Proc_Info (Policies) and Req_Rev_PP (Requests). In the Policies form I want to count how many records exist in the Requests Table which correspond to the SecCode of the current record in the Policies Form.


    If I try this it does not correctly count #in Req_Rev_PP that has same SecCode as current record in Pol_Proc_Info (returns 0):

    =DCount("[NumCode]","Req_Rev_PP","[NumCode]='&[Forms]![Pol_Proc_Info]![NumCode] & '")

    I can get the correct count when I give the exact value of SecCode
    (e.g. =DCount("[SecCode]","[Req_Rev_PP]","[SecCode] ='CP'") but not when I try to reference the current record.



    Ultimately I want to count records in Req_Rev_PP that have the same NumCode AND the same SecCode as current record in Pol_Proc_Info (i.e., matching on two fields), but have not been able to match on one yet.

    Any help will be greatly appreciated!

    --Annamarie

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    try this

    =DCount("[NumCode]","Req_Rev_PP","[NumCode]=' & Me![NumCode] & ' ")

  3. #3
    Join Date
    Nov 2003
    Posts
    2

    still having problems

    Originally posted by jmrSudbury
    try this

    =DCount("[NumCode]","Req_Rev_PP","[NumCode]=' & Me![NumCode] & ' ")

    I still keep getting "0" for every record even though I know some have matches in Req_Rev_PP. The same occurs if I substitute SecCode for NumCode.

Posting Permissions

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