ms access fix textbox #Erro

I had this question after viewing Import XML File Into Access Table Using VBA???.
Hi everyone,
I need help,
  I have one textbox and I use one function  =Nz(DSum("[Total]","Total_Customer_Qarz","[Customer_ID] = " & [Customer_ID]),0)
so when having records it's showing me correct but when have no record will give to me #ERROR!
adamdaban dabanStudentAsked:
Who is Participating?
crystal (strive4peace) - Microsoft MVP, AccessConnect With a Mentor Remote Training and ProgrammingCommented:

=DSum("[Total]","Total_Customer_Qarz", "[Customer_ID] = " & NZ([Customer_ID],0) )

I simply moved the NZ function

NZ is Null-to-Zero and returns 0, "", or whatever is in the optional second argument if the first argument does not have a value
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
when there is no record,  [Customer_ID] will not have a value --> substitute nz([Customer_ID],-99) where -99 is some value you do not have in your table

I see you do have NZ wrapped around the whole thing ... but that is not helping when there is no value in the control
adamdaban dabanStudentAuthor Commented:
sorry I'm not understanding your solution
adamdaban dabanStudentAuthor Commented:
Thanks it's work
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you're welcome ~ happy to help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.