Question For Microsoft Access Data Base

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #16
    Use this code:

    Code:
    Function fncMultiplier(ByVal lngI As Long) As Long
    
    If lngI = 0 Then
       fncMultiplier = 0
       Exit Function
    End If
    
    fncMultiplier = 1
    While lngI > 500
          fncMultiplier = fncMultiplier + 1
          lngI = lngI - 500
    Wend
    
    End Function
    And in the formfield use:
    Code:
    =B1 * fncMultiplier (NZ(A1))
    The added NZ() function will take care of Null (empty) fields.

    Nic;o)

    Comment

    • joeldault
      New Member
      • Jan 2010
      • 20

      #17
      This is what I have. It works, There is still a value for null and 00.00

      =fncMultiplier( NZ([Consideration]))*(NZ([StateTransTax]+[CountyTransTax]))

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #18
        Glad you guys got it sorted :)

        Comment

        • nico5038
          Recognized Expert Specialist
          • Nov 2006
          • 3080

          #19
          I would expect to see:
          Code:
          =fncMultiplier(NZ([Consideration])) * (NZ([StateTransTax])+NZ([CountyTransTax]))
          Being the multiplication factor derived from the "total amount" and multiplied by the (summed) tax.

          Nic;o)

          Comment

          • joeldault
            New Member
            • Jan 2010
            • 20

            #20
            nico5038
            Thanks your first one works fine, The problem I think is that the feilds for state tax and County tax have a default vaule in them and that is why there is a number showings for 0.00. I have to Find a way to multiply the state transfer tax of .55 per five hundred and 1.10 per five hundred in that statement that will work. Thanks for the responce.

            Comment

            • joeldault
              New Member
              • Jan 2010
              • 20

              #21
              Is there a way to stop getting this from stop returning the value of 11.00 when 0 is entered
              Code:
              If "" & Me!Number_of_Pages_in_Doc_1 < 0 > "" Then
              Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11

              Comment

              • MMcCarthy
                Recognized Expert MVP
                • Aug 2006
                • 14387

                #22
                Hi Joe

                Don't forget to put a forward slash (/) before the word code on the closing code tag.

                In answer to your questions, try this out ...
                Code:
                    If Me!Number_of_Pages_in_Doc_1 <> 0 _
                        Or NZ(Me!Number_of_Pages_in_Doc_1,"") <> "" Then
                
                        Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11 
                    Else
                        Me!Total_Costs_1=0
                    End If

                Comment

                • joeldault
                  New Member
                  • Jan 2010
                  • 20

                  #23
                  Thanks to all of you, I have been having a heck of a time on these problems, You guys have made the problem seam easy, That worked.

                  Comment

                  • MMcCarthy
                    Recognized Expert MVP
                    • Aug 2006
                    • 14387

                    #24
                    Nico and I have a few years doing this between us. You pick up a few things along the way :D One day you'll be the guru helping others.

                    Comment

                    • joeldault
                      New Member
                      • Jan 2010
                      • 20

                      #25
                      thanks for everything guys

                      Comment

                      Working...