Well, I figured out the problem was in my arithmetic.
Code:
Text_Height = Text_Feet * 12 + Text_Inches
If a text box is empty, it returns null. Although I'm not entirely sure what's going on under the hood, but my guess is that because vb is dynamically-typed, I can do arithmetic with that null value, which ostensibly results in the value of Text_Height also being null.
I tried this for poops and giggles, but it yelled at me at runtime:
Code:
Text_Height = CInt(Text_Feet) * 12 + CInt(Text_Inches)
So this was the very verbose solution:
Code:
Dim feet As Integer
If IsNull(Text_Feet) Then
feet = 0
Else
feet = Text_Feet
End If
Dim inches As Integer
If IsNull(Text_Inches) Then
inches = 0
Else
inches = Text_Inches
End If
Text_Height = feet * 12 + inches
On a related note, this much more compact code gives me an "Invalid use of null" error:
Code:
feet = IIf( IsNull(Text_Feet.Value), 0, CInt(Text_Feet) )
inches = IIf( IsNull(Text_Inches.Value), 0, CInt(Text_Inches) )
I like it much better and I wish I knew why.
And after doing lots more reading, this apparently is in fact the standard way to save a calculated value to a table. I think it's weird. Oh well.
Have a nice day.