Instead of using the value of a textbox directly, you use it via a function which can supply a default value, or before using the textboxes you check if they are empty and put the default value in.
As for a default function:
I left the data type Variant so as any type of default value can be returnedCode:Private Function TextBoxValue(TBox as TextBox, DefaultValue as Variant) as Variant If TBox.Text = "" Then TextBoxValue = DefaultValue Else TextBoxValue = Val(TBox.Text) End Function
You use the function wherever an "endangered TextBox" is used.
like myVar = TextBoxValue(Textx, 0)
myVar will receive 0 if the textbox is empty.




Reply With Quote