My problem is that data checking can get complicated and every time a new rule is needed I have to add another If statement in the vba module and re-issue the program so I'm trying to see a way of storing the If statements in a table so that I can edit/delete existing rules and add new ones.
Currently I open a recordsetclone and loop through looking for errors with If Then statements such as:
If Nz(rs!Qty) < 1 Then ErrTxt = ErrTxt & vbCrLf & rs!Line & " No Qty"
If ErrTxt <>"" the MsgBox ErrTxt
There are many lines of these statements so it would help to store "If Nz(rs!Qty) < 1 Then ErrTxt = ErrTxt & vbCrLf & rs!Line & " No Qty"" in a table then loop through the "Rules" table and Execute or Evaluate or Run each one at run time.
My latest failure is
Dim VbaString, testtxt
testtxt = "If Nz(Me.IValu) > 1 Then ErrTxt = ErrTxt & ' Very expensive'"
VbaString = testtxt
Eval (VbaString)
MsgBox "oops " & ErrTxt
I'm hoping someone can point me in the right direction. Many thanks, Mike
Currently I open a recordsetclone and loop through looking for errors with If Then statements such as:
If Nz(rs!Qty) < 1 Then ErrTxt = ErrTxt & vbCrLf & rs!Line & " No Qty"
If ErrTxt <>"" the MsgBox ErrTxt
There are many lines of these statements so it would help to store "If Nz(rs!Qty) < 1 Then ErrTxt = ErrTxt & vbCrLf & rs!Line & " No Qty"" in a table then loop through the "Rules" table and Execute or Evaluate or Run each one at run time.
My latest failure is
Dim VbaString, testtxt
testtxt = "If Nz(Me.IValu) > 1 Then ErrTxt = ErrTxt & ' Very expensive'"
VbaString = testtxt
Eval (VbaString)
MsgBox "oops " & ErrTxt
I'm hoping someone can point me in the right direction. Many thanks, Mike