Dsum for partial match

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msamhouri
    New Member
    • Oct 2012
    • 20

    Dsum for partial match

    Code:
    =DSum("AcctGroupID","2_Account_Group"," [AcctGroupName] = *" & [txtFilterType] & "*")
    
    =DSum("Column","Table"," [Column] = *" & [textLabel] & "*")
    Please i need help with this formula, I just dont know whats the problem?! it keeps give me error?
    Last edited by zmbd; Oct 9 '12, 06:20 PM. Reason: When posting XML, VBA, SQL, etc... please format it using the <CODE/> button.
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Where are you using the formula?
    What error are you getting?

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Looks like you're trying to do a wildcard match. First, you need to use the like operator, not the equal. Second, the right hand argument of the like operator needs to be a string so you have to demarcate it as such.

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Thank you Rabbit,

        (My mouse is doing weird things today, single clicks reading as double, clicks on stuff when I'm just moveing it... weird, had just moved it out of the way and it clicked on post and then selected the whole page - arrrrgh :( )

        Comment

        • msamhouri
          New Member
          • Oct 2012
          • 20

          #5
          Okay, the formula is in textbox in a form, this form filtering the data, so I need to get the total amount (Dsum) when I filter the data, for example when I write expenses the formula give me the right no
          Code:
          (=DSum("[AcctGroupID]","2_Account_GroupQ"," [AcctGroupName] = '" & [txtFilterType] & "'")
          but when I filter the data based on a part of the name such as (expen) the filter is working fine but the Dsum doesn’t work.
          So the dsum formula works only if I type the entire name not part of the name.
          Can you give me your suggestion please
          Sorry for my bad English writing,
          I hope you got it
          Thank you in advance for your help
          Last edited by zmbd; Oct 9 '12, 09:29 PM. Reason: Please use <CODE/> to format the code!

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            No problem z, are you using a wireless? Sometimes my mouse does weird stuff when it's running low on batteries.

            @msamhouri, I gave you my suggestion in my previous post.

            Comment

            • msamhouri
              New Member
              • Oct 2012
              • 20

              #7
              still i dont get it can you correct the formula for me

              Comment

              • twinnyfo
                Recognized Expert Moderator Specialist
                • Nov 2011
                • 3665

                #8
                msanhouri,

                Try this:

                Code:
                =DSum("AcctGroupID","2_Account_Group","[AcctGroupName] [B][U]LIKE '[/U][/B]" & [txtFilterType] & "*[B][U]'[/U][/B]") 
                  
                =DSum("Column","Table","[Column] [B][U]LIKE '[/U][/B]" & [textLabel] & "*[B][U]'[/U][/B]")
                Please note the Bold and Underline, which plays out Rabbit's suggestion.

                Comment

                • msamhouri
                  New Member
                  • Oct 2012
                  • 20

                  #9
                  Thank you, That has solved the issue!

                  I appreciate it. I spent hours trying to figure this out.

                  Thank you so much

                  Comment

                  • twinnyfo
                    Recognized Expert Moderator Specialist
                    • Nov 2011
                    • 3665

                    #10
                    Any time! Glad I could help!

                    Comment

                    Working...