My NZ function not fully working

cikwan82

Registered User.
Local time
Tomorrow, 04:02
Joined
Dec 10, 2013
Messages
45
Hi to all my friends, i'm sorry if this question should not be asked . i have simple form i attach below, the problem is, when i apply nz function to this textbox (in control source) , some of textbox not showing the answer.

Total time : =CCur(Nz([Masa1],"0"))+CCur(Nz([Masa2],"0"))+CCur(Nz([Masa3],"0"))+CCur(Nz([Masa4],"0"))+CCur(Nz([Masa5],"0"))+CCur(Nz([Masa6],"0"))+CCur(Nz([Masa7],"0"))+CCur(Nz([Masa8],"0"))----- its working good

Total Price:
=CCur(Nz([Total1],"0"))+CCur(Nz([Total2],"0"))+CCur(Nz([Total3],"0"))+CCur(Nz([Total4],"0"))+CCur(Nz([Total5],"0"))+CCur(Nz([Total6],"0"))+CCur(Nz([Total7],"0"))+CCur(Nz([Total8],"0"))----- not working (#Size! will appear when i start click the analisis box)

Total Test :
=CCur(Nz([Total1],"0"))+CCur(Nz([Total2],"0"))+CCur(Nz([Total3],"0"))+CCur(Nz([Total4],"0"))+CCur(Nz([Total5],"0"))+CCur(Nz([Total6],"0"))+CCur(Nz([Total7],"0"))+CCur(Nz([Total8],"0"))----- not working (#Type! will appear when i start click the analisis box)

Please guide me, i'm new in sql language or access... Thanks for somebody can help me..


P/s : Here i attach my form if my friend can make any correction
 

Attachments

  • Form2.mdb
    Form2.mdb
    608 KB · Views: 145
  • Form2.jpg
    Form2.jpg
    55.6 KB · Views: 162
Remove the CCur from very single field, and apply it only to the final result, also use 0 not "0".. What I mean is.. Instead of..
Code:
=CCur(Nz(field1, "0")) + CCur(Nz(field2, "0")) + CCur(Nz(field3, "0")).....
Try..
Code:
= CCur(Nz(field2, 0) + Nz(field2, 0) + Nz(field2, 0)....)
PS: I have not looked at your File
 
Can also be that your field is NOT a null value but an Empty String... they are not the same thing and NZ will only function for NULL values.
 
had a look at your file but I'm hitting my head on a brick wall, here - why is your form and all the fields on it unbound?
 
Can also be that your field is NOT a null value but an Empty String... they are not the same thing and NZ will only function for NULL values.

I had a look at the code behind the form, my earlier assumption was correct....
Code:
            Me.TextHarga4 = ""
That should probably be...
Code:
            Me.TextHarga4 = Null

And then it should work, still have my questions about your design as well as your coding....
i.e. instead of assigning the SQL 8 times, you can do something like:
Code:
mySQL = "Select ... bla bla" 

Me...1.rowsource = mySQL
this way if the sql ever changes ....
Also if you feel you need to have 8 fields....
Code:
For i = 1 to 8
Me.Controls("textHarga" & i) = Null
Me.Controls("cboanalisis" & i) = mysql
next i

And why have "me.cbo.requery" two times? try to avoid ever doing things two times and try even harder to use "Exit Sub" and/or "Goto" lines whenever whereever possible.

As for your design, having a table called January makes me itch because the next will be a table Februari, March, etc.
 
Thank you to all my friend.. especially for namliam and pr2-eugin.. you all very smart ... finally my form fully working .... thanks a lot...
 

Users who are viewing this thread

Back
Top Bottom