Hi,
I am trying to check if a value (date) is in a array; this is my code:
The InStr gives me an error message like 'error 5 was generated, invalid procedure call or argument' and the same message for updated code 'InStr(Join(SVIATKY), STD)'.
Any idea please?
I am trying to check if a value (date) is in a array; this is my code:
Code:
Dim SVIATKY() As Date
Dim STD As Date
Dim K, KLK As Integer
'adding value into array
sSQL = "Select [SH] From [STATS];"
Set rst4 = New ADODB.Recordset
rst4.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
KLK = rst4.RecordCount
ReDim SVIATKY(1 To KLK) As Date
For K = 1 To KLK
SVIATKY(K) = rst4.Fields(0).Value
rst4.MoveNext
Next
'testing if my array contains a specific date - getting error message
If InStr(Join(SVIATKY), STD, 1) > 0 Then
'execute code if match found
End if
The InStr gives me an error message like 'error 5 was generated, invalid procedure call or argument' and the same message for updated code 'InStr(Join(SVIATKY), STD)'.
Any idea please?