I am trying to use an array in a If statement inside a For loop to cycle through serveral check boxes on a form. The For loop works but the If statment gives me a Run-Time Error '13' Type mismatch error.
Is it even possible to use an array in a If statement?
An excerpt for the code is as follows:
Dim verStore1(4) As String
Dim verStore2(4) As String
Dim i As Long
verStore1(0) = "OOS"
verStore1(1) = "RTS"
verStore1(2) = "PM"
verStore1(3) = "CAL"
verStore2(0) = "[OOS_Check]"
verStore2(1) = "[RTS_Check]"
verStore2(2) = "[PM_Check]"
verStore2(3) = "[CAL_Check]"
For i = 0 To 3
verstr = "[Forms]![F_Maintenance_Log]!" & verStore2(i)
If verstr = True Then
Me.[Variable_Field] = Me.[Variable_Field] & verStore1(i) & vbCrLf
Else
End If
Next i
Is it even possible to use an array in a If statement?
An excerpt for the code is as follows:
Dim verStore1(4) As String
Dim verStore2(4) As String
Dim i As Long
verStore1(0) = "OOS"
verStore1(1) = "RTS"
verStore1(2) = "PM"
verStore1(3) = "CAL"
verStore2(0) = "[OOS_Check]"
verStore2(1) = "[RTS_Check]"
verStore2(2) = "[PM_Check]"
verStore2(3) = "[CAL_Check]"
For i = 0 To 3
verstr = "[Forms]![F_Maintenance_Log]!" & verStore2(i)
If verstr = True Then
Me.[Variable_Field] = Me.[Variable_Field] & verStore1(i) & vbCrLf
Else
End If
Next i