Sorry, this ended up being a little lengthy.

Hi, I have some experience with VBA in Access, but have never tried to create a new function or module in before. I am hoping that someone can help me out with what I'm trying to do.

For the sake of simplicity, I have reduced the number of text box controls in this example down to 8 and have named them as the following.
ctlBox1, ctlBox2, ctlBox3
ctlBoxResult1, ctlBoxResult2, ctlBoxResult3
ctlBoxTotal, ctlBoxResultTotal

ctlBox 1-3 are input boxes, where the user will enter a number.
ctlBoxResult 1-3 are calculation boxes based on the ctlBox 1-3 inputs.
ctlBoxResult1 = ctlBox1 * 0.392
ctlBoxResult2 = ctlBox2 * 2.438
ctlBoxResult3 = ctlBox3 * 10.617

ctlBoxTotal and ctlBoxResultTotal are calculation boxes based on ctlBox 1-3 and ctlBoxResult 1-3, respectively.
ctlBoxTotal = ctlBox1 + ctlBox2 + ctlBox3
ctlBoxResultTotal = ctlBoxResult1 + ctlBoxResult2 + ctlboxResult3

I want ctlBoxResult1-3 to update their values on BeforeUpdate() for their respective ctlBox1-3, however, I want it conditional that if no value has been inputted for their respective ctlBox, then the result boxes will have no value as well. Similarly, I want ctlBoxTotal and ctlBoxResultTotal to update their values on BeforeUpdate() for any ctlBox1-3, however, I want it conditional that if any of the ctlBox1-3 has no value inputted, then ctlBoxTotal and ctlBoxResultTotal have no values.

Here's an example of the code I have for this (for ctlBox1), which works:


__________________________________________________ _____
Private Sub ctlBox1_BeforeUpdate(Value As Integer)

' calculates "ctlBoxResult1" when a value is entered into ctlBox1
ctlBoxResult1 = ctlBox1 * 0.392

' calculates "ctlBoxTotal" and "ctlBoxResultTotal" values when a value is entered into ctlBox1, but only if the other two controls ctlBox1 and ctlBox2 have values inputted.
If IsNull(ctlBox1) Or IsNull(ctlBox2) Or IsNull(ctlBox3) _
Then
[ctlBoxTotal] = ""
[ctlBoxResultTotal] = ""
Else
CtlBoxTotal = ctlBox1 + ctlBox2 + ctlBox3
CtlBoxResultTotal = ctlBoxResult1 + ctlBoxResult2 + ctlBoxResult3
End If

End Sub
__________________________________________________ _____

The problem with this is that I have many more than 8 boxes and have add this under each ctlBox BeforeUpdate() which is time-consumin, sloppy, increases the chances of errors, and makes changing it later difficult, which is important, because I know I will have to.

Can anyone help me create a module/function that I can just call under each ctlBox's BeforeResult when I need to? Thanks!