435,551 Members | 2,727 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,551 IT Pros & Developers. It's quick & easy.

# can this code be fixed

 P: 20 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 Expand|Select|Wrap|Line Numbers    If "" & Me!Number_of_Pages_in_Doc_1 < 0 > "" Then    Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11  Jan 5 '10 #1

#### ✓ answered by missinglinq

This will do what you ask:
Expand|Select|Wrap|Line Numbers
1. =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

5 Replies

 Expert 2.5K+ P: 3,532 Your code isn't at all clear to me, but I think this is what you're trying to do: Expand|Select|Wrap|Line Numbers 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_Pages_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)> Jan 5 '10 #2

 P: 20 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 Jan 5 '10 #3

 P: 20 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 Jan 5 '10 #4

 Expert 2.5K+ P: 3,532 This will do what you ask: Expand|Select|Wrap|Line Numbers =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 Jan 5 '10 #5

 P: 20 Thanks, That Did it, I have one more questions I will Post and then I hope I am done, Thanks Jan 5 '10 #6