Hello all,
Problem:
Cannot redirect the user back to the Userform to re-enter correct data into textboxes after a messagebox appears due to an incorrect entry.
Explanation:
1) The userform consists of thirty (30) textboxes that are categorized under separate frames based on the type of data (geometry, material properties...etc).
2) The userform consists of ten (10) checkboxes. Based on the selected number of checkboxes, a certain number of the textboxes are enabled for data entry that would be used further in the code for calculations. For example, if a user selects Internal Pressure checkbox, only 7/30 textboxes are enabled for data entry. If they select Internal Pressure and Buckling, 12/30 textboxes are enabled and so on.
3) The textboxes are error checked for 2 conditions: no value entered and a value of 0 entered.
a) If there are no errors, the textbox.value is then stored in a declared variable to be used for an initial calculation.
b) If there are errors, a message box is prompted but the code continues on with the incorrect entry regardless. (would like to redirect user here after every error).
5) The result of the initial calculation is range checked to see if it falls within a specified upper and lower bounds.
a) If there are no errors, the declared variable is used for secondary calculations.
b) If there are errors, a message box is prompted but the code continues on with the incorrect entry regardless.(would like to redirect user here again after every error).
6) The error check, initial calculation, range check and secondary calculation for each of the checkboxes are under one Sub, and are called when the Submit (in my case it is Compute) button is clicked.
I would like the code to redirect the user back to the form to input the correct data rather than continuing on. I have seen examples where Exit Sub is used but since I continue using the variables in the same Sub, it is not relevant. Only thing I can think of is maybe some sort of While loop.
Any help would be appreciated.
Thank you.
Here is a sample of the code (I cannot show the full code since there are confidential information but this example shows only one of the enabled textboxes). In this case the Private Sub Compute_Click() calls Sub UT_Compute() which calls Sub BP_UT():
Bookmarks