Again DCount :)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rano575
    New Member
    • Jul 2007
    • 5

    #1

    Again DCount :)

    i am making a database about the survaing instruments in my company and all i want to do i have a query that i collected all the data i want with the design i want and a made group by to the instrument according to the type of the instrument.
    the field i want to run the DCount function on is the Type and first i make a count to count each group and within the group i want to count all the instrument from the same type that in our stores so i used this expression :

    =DCount("[SN]";"MainInstrume ntQuery";"[Location]='Store'")

    but all i got is the total numbers of all the types instead.
    i'll appreciate any help,
    thanks,
    Rania
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by rano575
    i am making a database about the survaing instruments in my company and all i want to do i have a query that i collected all the data i want with the design i want and a made group by to the instrument according to the type of the instrument.
    the field i want to run the DCount function on is the Type and first i make a count to count each group and within the group i want to count all the instrument from the same type that in our stores so i used this expression :

    =DCount("[SN]";"MainInstrume ntQuery";"[Location]='Store'")

    but all i got is the total numbers of all the types instead.
    i'll appreciate any help,
    thanks,
    Rania
    Try it this way if Location is a text data type:

    =DCount("[SN]","MainInstrume ntQuery","[Location]= '" & Store & "'")

    Try it this way if Location is a numeric data type:

    =DCount("[SN]","MainInstrume ntQuery","[Location]= " & Store)

    Comment

    • rano575
      New Member
      • Jul 2007
      • 5

      #3
      i'm sorry it didnt work it outputs a box asking me to enter the value of the store , but i'm using this statement as an expression in a text box and i wrote it in its control source
      thanks for your fast respond :)
      Rania

      Comment

      • rano575
        New Member
        • Jul 2007
        • 5

        #4
        Originally posted by rano575
        i'm sorry it didnt work it outputs a box asking me to enter the value of the store , but i'm using this statement as an expression in a text box and i wrote it in its control source
        thanks for your fast respond :)
        Rania
        i was thinkin, correct me if wrong, it got out of the group (that depends on the Type of the instrument) i made in the report why is that? is there is anyway to get the Type involved dynamically the group into the DCount function like i did when i count the instrument in each group just i wrote Count([Type]) ?

        Comment

        • puppydogbuddy
          Recognized Expert Top Contributor
          • May 2007
          • 1923

          #5
          Originally posted by rano575
          i was thinkin, correct me if wrong, it got out of the group (that depends on the Type of the instrument) i made in the report why is that? is there is anyway to get the Type involved dynamically the group into the DCount function like i did when i count the instrument in each group just i wrote Count([Type]) ?
          Store should correspond to the name property of your textbox on on the form that is used to enter the Location. So, recheck the name property on that textbox.

          As to the Group being [Type], your problem may be related to the fact that the textbox holding the Count or DCount is not in the group footer....the group footer section for [Type] is where you should have the Count/DCount.

          Comment

          • rano575
            New Member
            • Jul 2007
            • 5

            #6
            Originally posted by puppydogbuddy
            Store should correspond to the name property of your textbox on on the form that is used to enter the Location. So, recheck the name property on that textbox.

            As to the Group being [Type], your problem may be related to the fact that the textbox holding the Count or DCount is not in the group footer....the group footer section for [Type] is where you should have the Count/DCount.
            that is right i didnt put the DCount in the group footer but i did it and it still didnt work it still overcome the group and give me the total number of all instruments that is in the Store

            Comment

            • puppydogbuddy
              Recognized Expert Top Contributor
              • May 2007
              • 1923

              #7
              Originally posted by rano575
              that is right i didnt put the DCount in the group footer but i did it and it still didnt work it still overcome the group and give me the total number of all instruments that is in the Store
              1. Make sure you are using the equal sign in the expression for the count when the expression is in the footer..
              = Count([Type])

              2. if you want the report to show Type by store, you need to have [Type] set up as the first (top level) group in the report (using the sorting/grouping), then store as the second level group as shown. The count has to be in the footer of [type] :

              Type
              Store

              3. if you want to see Store and all the Types, then Store has to be the top level group and the Count still has to be in the footer of [Type]

              Store
              Type

              Comment

              • rano575
                New Member
                • Jul 2007
                • 5

                #8
                Originally posted by puppydogbuddy
                1. Make sure you are using the equal sign in the expression for the count when the expression is in the footer..
                = Count([Type])

                2. if you want the report to show Type by store, you need to have [Type] set up as the first (top level) group in the report (using the sorting/grouping), then store as the second level group as shown. The count has to be in the footer of [type] :

                Type
                Store

                3. if you want to see Store and all the Types, then Store has to be the top level group and the Count still has to be in the footer of [Type]

                Store
                Type
                i think you miss understand me the Store is a big place where we store the instruments or machines that is not used in any projects and there for there will be two kind of locations i can find my machines in "Store" or "Any Other Project ", this is the story about the "Store", about the Type i have 4 types of survaying machines
                1-TOTAL STATION
                2-THEODOLAITE
                3-AUTOMATICE LEVEL
                4-PRISM

                and i want for each kind of the above 4 to count the numbers Stored in the "Store" and the number in all the projects i dont care about what the name of the project i.e. "out of Store"
                i hope i cleard the situation, and sorry for the misunderstandin g

                Comment

                • puppydogbuddy
                  Recognized Expert Top Contributor
                  • May 2007
                  • 1923

                  #9
                  Originally posted by rano575
                  i think you miss understand me the Store is a big place where we store the instruments or machines that is not used in any projects and there for there will be two kind of locations i can find my machines in "Store" or "Any Other Project ", this is the story about the "Store", about the Type i have 4 types of survaying machines
                  1-TOTAL STATION
                  2-THEODOLAITE
                  3-AUTOMATICE LEVEL
                  4-PRISM

                  and i want for each kind of the above 4 to count the numbers Stored in the "Store" and the number in all the projects i dont care about what the name of the project i.e. "out of Store"
                  i hope i cleard the situation, and sorry for the misunderstandin g
                  Yes, I did misunderstand. Ok, so how is your report layed out.? Something like this?

                  ..........Type. ............... ..............L ocation

                  TOTAL STATION........ ............... .. Store
                  THEODOLAITE.... ............... ...........Othe r
                  AUTOMATICE LEVEL ............... .....Store
                  PRISM.......... ............... ............... ....Other

                  Total Counts ............... ............... ............... ...........Stor e..XX.....Other XX

                  Comment

                  Working...