Use the Nz function. This will replace any Nulls with a zero. Private Sub B_LostFocus( ) SUM = Nz(A,0) + Nz(B,0) End Sub
________________________________ From: P S <discworld2...@yahoo.com> To: ms_access@yahoogroups.com Sent: Friday, June 12, 2009 5:36:16 PM Subject: [ms_access] Need help getting a SUM Hello all, I need some help generating a sum of 2 fields, where at least one field is in blank. I've attached a very small database that shows what I'm trying to do. I have 8 rows, and 4 columns. ID, A, B, SUM. SUM = A + B. However, when A is blank or B is blank, I'm getting a blank value for SUM. I would like to recode "blank As" and "blank Bs" to zero, so that I can get always get a value for SUM. I have 1,000 rows, so I don't want to enter this data again. Here is my code: Private Sub B_LostFocus( ) SUM = A + B End Sub Does anyone know how to recode A and B to make sure that I am getting a SUM for every row? Thanks, Pablo [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]