can this code be fixed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joeldault
    New Member
    • Jan 2010
    • 20

    #1

    can this code be fixed

    Is there a way to fix this code so it stops returning the value of $11.00 when $0.00 is entered. Thanks in advance. You all have been great

    Code:
       If "" & Me!Number_of_Pages_in_Doc_1 < 0 > "" Then
       Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Your code isn't at all clear to me, but I think this is what you're trying to do:
    Code:
    If Nz(Me!Number_of_Pages_in_Doc_1, 0)  > 0 Then
        Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11 
    End If
    If Me!Number_of_Pa ges_in_Doc_1 is empty (Null) then Nz() converts it to Zero, and if it is then > 0 it runs your calculation.

    If you need it to return a value if it is now Zero, like $0.00, use an Else clause to to that.

    Linq ;0)>

    Comment

    • joeldault
      New Member
      • Jan 2010
      • 20

      #3
      Thanks for your responce, That sis not work. It still Returns the Value of 11.00 I has something to do with the 11 after then then, If I take ot out. I get 0.00 or 0 pages

      Comment

      • joeldault
        New Member
        • Jan 2010
        • 20

        #4
        I have Typed Rhis is the Controll source and it still returns the value of $11.00 When 0 is Typed
        =Nz(11+3*[Number_of_Pages _in_Doc_1],0)

        I need have the first page of a document cost 14.00 and easch addition page costs $3.00. I am entering in a field on a form the # of pages and I need to get a total

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          This will do what you ask:
          Code:
          =IIf(Nz([Number_of_Pages_in_Doc_1],0)>0,([Number_of_Pages_in_Doc_1]*3)+11,0)
          If you'd given a clear description of what you were actually trying to accomplish this would have been answered in the first response.

          And do not, I repeat do not, take code that you have been provided here, change it around completely, and then respond "That sis not work!"

          All of these things waste the time of the volunteers here who are trying to help you!

          Linq

          Moderator

          Comment

          • joeldault
            New Member
            • Jan 2010
            • 20

            #6
            Thanks, That Did it, I have one more questions I will Post and then I hope I am done, Thanks

            Comment

            Working...