Text Box Calculations - Totals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marsh888
    New Member
    • Nov 2009
    • 5

    Text Box Calculations - Totals

    Looking to create a text box that counts a field between to paramaters. I got this far but doesn't seem to be working
    Code:
    Select (store)
    From (All Info)
    Where store between waves "9" and "12"
    There are a certain amount of stores in each wave - I am trying to count the number of stores.

    Marsh
    Last edited by NeoPa; Nov 3 '09, 12:41 AM. Reason: Please use the [CODE] tags provided.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    You can set the data source on the text box control to something like:
    Code:
    =DCount("store", "All Info", "wave >= 9 and wave <= 12")

    Comment

    • ajalwaysus
      Recognized Expert Contributor
      • Jul 2009
      • 266

      #3
      What ChipR is suggesting should work, but I have one question, is "Wave" a text or number field, because you are using it as a text field by wraping it in double quotes, but ChipR's code assumes that "Wave" is a number. Just keep that in mind when using ChipR's code.

      -AJ

      Comment

      • marsh888
        New Member
        • Nov 2009
        • 5

        #4
        It is a number, but does not work.
        Table = All Info
        Field = Store (Number of stores that needed to be Counted)
        Field = Wave (Between "9" and "12")
        Only want the total number of stores between ( 9 and 12

        Comment

        • ajalwaysus
          Recognized Expert Contributor
          • Jul 2009
          • 266

          #5
          Well try Chip's code, since his response will work for your needs, he went through the effort of writing it up for you.

          Also, if you want something for a query, here is how your query should look:
          Code:
          Select Count(*) as Count_Of_Stores
          From [All Info]
          Where [All Info].waves between 9 and 12
          Both codes should work, the key is you need to drop the double quotes as you have already indicated that Waves is a number not text.

          -AJ

          Comment

          • marsh888
            New Member
            • Nov 2009
            • 5

            #6
            Chip - Your code worked.

            Thanks for the help

            Comment

            • marsh888
              New Member
              • Nov 2009
              • 5

              #7
              What if the fields are Date fields ?

              Comment

              • ajalwaysus
                Recognized Expert Contributor
                • Jul 2009
                • 266

                #8
                Originally posted by marsh888
                What if the fields are Date fields ?
                Code:
                Where MyDate Between #1/1/2009# and #12/31/2009#
                or
                Code:
                Where MyDate >= #1/1/2009# and MyDate <= #12/31/2009#
                Take the Where out if you put it in the DCount function ChipR provided.

                -AJ

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32633

                  #9
                  Reading through this is a bit like watching sand :S Having said that, Quotes (') and Double-Quotes (") - Where and When to use them & Literal DateTimes and Their Delimiters (#) may be of some use.

                  Comment

                  • marsh888
                    New Member
                    • Nov 2009
                    • 5

                    #10
                    I am trying to use the dcount like chip suggested. It worked when counting number of fields with values. However, I am trying to count total number of date fields that are not blank. Therefore, trying to manipulate the following line:
                    Code:
                    =Dcount("1st Review","All Info", "wave >= 9 and wave <= 12")
                    Thanks,

                    marsh
                    Last edited by NeoPa; Nov 3 '09, 02:32 PM. Reason: Please use the [CODE] tags provided.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32633

                      #11
                      Please notice the Edit Comments I keep having to add to your posts. I'd rather not issue you with a site warning for something so easy to resolve.

                      PS. Tags (generally) are done as matching pairs where the opening one is surrounded by [...] and the closing one by [/...]. A set of buttons is available for ease of use in the Standard Editor (Not the Basic Editor). The one for the [ CODE ] tags has a hash (#) on it. You can choose which editor to use in your Profile Options (Look near the bottom of the page). You must select the code in your post, and hit the button on the tool bar which looks like a hash (#). This will automatically format the post such that the [ CODE ] tags surround the code you're posting. This will display the code in a Code Box, quite differently from the standard formatting of a post.

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32633

                        #12
                        Assuming you want what you've requested, then try :
                        Code:
                        =DCount('[Wave]','[All Info]')

                        Comment

                        Working...