Hi - interesting one (and possibly easy to solve)...
I am writing some vba for a custom outlook form - and as part of the validation process the code runs through a number of checks, ticking box's here and there... once it's checked the box's it will create a custom error message advising the user the parts they haven't done correctly.
The (cut-down) code is as follows
VAL_T_01.value and _
VAL_T_02.value and _
VAL_T_03.value and _
VAL_T_04.value and _
VAL_T_05.value and _
VAL_T_06.value and _
T_PASS.value = true
T_PASS.value = false
OOO_T_ErrCode = "TOP SECTION ERRORS"
for x = 1 to 7
set valbox = MP.Controls("VAL_T_0" & x)
valerr = "OOO_T_ValErr" & x
if valbox.value = false then
OOO_T_ErrCode = OOO_T_ErrCode & chr(10) & valerr
In the 'for loop', this checks to see if the user has passed each step (populated via a previous sub) - if they have T_PASS is ticked. if they fail, an error message is generated with custom "you haven't completed x" strings (OOO_T_ValErr1, OOO_T_ValErr2 etc)
As it loops through, it sets the VAL_T_01/VAL_T_02 etc variable absolutely fine and reads the relevant field as it needs to. But I'm trying to get it to loop through the error message variables, but it returns as a new string...
Any ideas how to merge the two and read the specific variable it refers to?