addition with 0

  • Thread starter peljo via AccessMonster.com
  • Start date
P

peljo via AccessMonster.com

My update function does not always work properly, especially when one of the
fields is 0 or blank.How could i improve my function so that when addding wih
0 not to give 0 ?

My function is the following:
Public Function dummy()
StrSQL = " UPDATE (products1 INNER JOIN products ON products1.Productid =
products.Productid) INNER JOIN [Order Details1] ON " & _
" products1.Productid = [Order Details1].productid SET products1.items1 =
[order details1].[quantity]+[products1].[items1]"
End Function
 
J

John W. Vinson

My update function does not always work properly, especially when one of the
fields is 0 or blank.How could i improve my function so that when addding wih
0 not to give 0 ?

My function is the following:
Public Function dummy()
StrSQL = " UPDATE (products1 INNER JOIN products ON products1.Productid =
products.Productid) INNER JOIN [Order Details1] ON " & _
" products1.Productid = [Order Details1].productid SET products1.items1 =
[order details1].[quantity]+[products1].[items1]"
End Function

Adding a 0 will always just do that - add a zero, and give the correct answer.

Adding a NULL will give NULL as the result. If one field may be null, use the
NZ (Null To Zero) function to convert it to a zero:

NZ([order details1].[quantity])+NZ([products1].[items1])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

delete query 1
Update query 3
Syntax error 2
Update query 2
Wierd Results from a combobox and recordsource 1
union query 0
Problem with Queries 0
Looping through Product Recipe Until found original Component 0

Top