Hello,
I am getting a "type mismatch" error when looping through Boolean variables trying to identify any variables that have a value of FALSE.
My code resides in a Module and is below:
Code:
Public txt1Changed As Boolean
Public txt2Changed As Boolean
Public txt3Changed As Boolean
Public txt4Changed As Boolean
Public txt5Changed As Boolean
Public txt6Changed As Boolean
Public txt7Changed As Boolean
Public txt8Changed As Boolean
Public cbo1Changed As Boolean
Public cbo2Changed As Boolean
Public cbo3Changed As Boolean
Public Sub Test()
txt1Changed = True
txt2Changed = True
txt3Changed = True
txt4Changed = True
txt5Changed = True
txt6Changed = True
txt7Changed = False
txt8Changed = True
Dim i As Integer
For i = 1 To 8
If ("txt" & CStr(i) & "Changed") = False Then
MsgBox ("Textbox " & i & " has not been changed.")
'.SetFocus
Exit Sub
End If
Next i
End Sub
Once I get this to work, I will be applying this to a VBA form that validates that all fields on a form have been changed before allowing the user to submit the data.
Thanks for any help