Results 1 to 7 of 7

Thread: LOOP and array

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,941

    LOOP and array

    I loop a series of date from a for next cicle

    similar:

    For Each olItm In olFld.Items
    If InStr(olItm.Subject, "abd") Then
    TEST = olItm.ReceivedTime

    'here store date into array

    End If
    Next

    i need to store all dates from the loop and when the loop finish extract the newst date from array, is possible?

    Note:
    Test is dimensioned as Date

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Re: LOOP and array

    before doing any processing on your recordset, why not use the '.sort' method first to get the data into the order you want.

  3. #3
    Lively Member
    Join Date
    Aug 2009
    Posts
    98

    Re: LOOP and array

    Yes just after storing date into the array, use sorting of all recordset by Date in ascending / descending order so that it will be arranged as per date and you will get the sorted data.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,941

    Re: LOOP and array

    Quote Originally Posted by Bill Crawley View Post
    before doing any processing on your recordset, why not use the '.sort' method first to get the data into the order you want.
    hummmmm....

    my code go in error:
    Code:
    ....
    Dim ARRAY_DATE() As Date    'Array DELLE DATE
    ....
    
    I=0
    For Each olItm In olFld.Items
    If InStr(olItm.Subject, "te") Then
    TEST = olItm.ReceivedTime
    ARRAY_DATE(I) = Format(TEST, "DD/MM/YYYY")
    I = I + 1
    End If
    Next
    Last edited by luca90; Apr 13th, 2011 at 04:34 AM.

  5. #5
    Lively Member
    Join Date
    Aug 2009
    Posts
    98

    Re: LOOP and array

    I think if u post ur code with data file, it will be easy to help.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,941

    Re: LOOP and array

    Quote Originally Posted by Smartchap View Post
    I think if u post ur code with data file, it will be easy to help.
    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

    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

  7. #7
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: LOOP and array

    You're not re-dimensioning the Dynamic Array
    Code:
    ....
    Dim ARRAY_DATE() As Date    'Array DELLE DATE
    ....
    
    I=0
    For Each olItm In olFld.Items
        If InStr(olItm.Subject, "te") Then
           TEST = olItm.ReceivedTime
           ReDim Preserve ARRAY_DATE(I)
           ARRAY_DATE(I) = Format(TEST, "DD/MM/YYYY")
           I = I + 1
        End If
    Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width