[RESOLVED] insert in array the little value...
With this code i loop item and fill array.
But during the loop of value i can have alway a pair of date similar:
01/01/2011 19.00.14
and
01/01/2011 05.00.11
....
02/01/2011 19.00.27
and
02/01/2011 05.00.02
i need to compare the two pair of dates and insert into array only the most little date from the pair... in this case fill the array with:
01/01/2011 05.00.11
02/01/2011 05.00.02
Code:
For Each olItm In olFld.Items
If InStr(olItm.Subject, "test") Then
TEST = olItm.ReceivedTime
ReDim Preserve ARRAY_DATE(I)
ARRAY_DATE(I) = TEST
I = I + 1
End If
Next
note:
TEST is the var filled with dates
Re: insert in array the little value...
you could do a sql query on the olfied items, in order by receivedtime, then it would be simple to to loop through the recordset, skipping until the next day value
Re: insert in array the little value...
Quote:
Originally Posted by
westconn1
you could do a sql query on the olfied items, in order by receivedtime, then it would be simple to to loop through the recordset, skipping until the next day value
if is most simple i post my question on other side:
Admitting i loop the series of value with a for next how to fill combobox items with the value marked with < - Selected
In effect i need to fill the items oin combo with the dates vale with the oldest time:
...
01/01/2011 05.00.11 <- Selected
01/01/2011 19.00.14
01/01/2011 21.21.11
02/01/2011 05.00.02 <- Selected
03/01/2011 01.00.03 <- Selected
03/01/2011 12.17.21
03/01/2011 18.00.27
....
Re: insert in array the little value...
vb Code:
Dim xarr() As String, y As Integer
ReDim xarr(UBound(myarr))
xarr(0) = Left(myarr(0), 19)
For i = 1 To UBound(myarr)
myarr(i) = Left(myarr(i), 19)
If DateDiff("d", xarr(y), myarr(i)) > 0 Then
y = y + 1
xarr(y) = myarr(i)
End If
Next
ReDim Preserve xarr(y) ' resize final array
i tested this pasting your little table, in post above, into myarr, and had the correct result in xarr
this assumes that as your example the dates are already in order
if not you can sort the initial array by date, there are many examples in this forum and code bank for sorting arrays
note i had to remove the "<-selected" (left 19) or i got i type mismatch in the date function
Quote:
?join(xarr," ~ ")
01/01/2011 05.00.11 ~ 02/01/2011 05.00.02 ~ 03/01/2011 01.00.03