Problem using calculated expression within Dcount

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidwelli
    New Member
    • Apr 2007
    • 10

    #1

    Problem using calculated expression within Dcount

    Hello,

    All help is appreciated, I'm struggling with the following.

    Using Access 2003 (front end) connecting to Oracle 7 database (back end). I'm trying to create a query in access that will show how many instances of something happens.

    Within the query I am using a calculated filed called "registered".Th e syntax is

    Registered: DateDiff("w",[date_valid],[timestamp])

    This returns a number 0.00, 1.00, 2.00 etc

    Within the query or form (I've tried both), I'm trying to count the number times that 0.00 appears. I will then take this figure and use it to calculate the percentage. My problem is when using the dcount function to count the instances that something appears. I've tried the following

    DCount("salary" ,"Applications" ,"registered=0. 00")

    This is where the errors start, I've also tried

    DCount("salary" ,"Applications" ,"(DateDiff(""w "",[date_valid],[timestamp]))=1.00")

    but this also errors with the same message. The error message always refers to "Start Date" which is one of the parameters of "date_valid " (the other being "End Date"). I've removed this parameter but it still asks for it.

    Where am I going wrong?
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    In a new query based on the first query ...
    Code:
    Count0: Sum(IIf(Registered=0.00,1,0))
    Count1: Sum(IIf(Registered=1.00,1,0))
    Count2: Sum(IIf(Registered=2.00,1,0))
    Mary

    Comment

    • davidwelli
      New Member
      • Apr 2007
      • 10

      #3
      Originally posted by mmccarthy
      In a new query based on the first query ...
      Code:
      Count0: Sum(IIf(Registered=0.00,1,0))
      Count1: Sum(IIf(Registered=1.00,1,0))
      Count2: Sum(IIf(Registered=2.00,1,0))
      Mary
      Thanks for that, you have solved my problem, I didn't know about the IIF function.

      Thanks again

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by davidwelli
        Thanks for that, you have solved my problem, I didn't know about the IIF function.

        Thanks again
        You're welcome.

        Comment

        Working...