Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2011
    Posts
    27

    Red face Unanswered: array sortimg (data and time array)

    i need to sort some arrays in the basis of date and time , i wrote some code.but it does not work properly.please help me


    For i = 1 to Rec_count

    For j = i+1 to Rec_count

    if(CaldTime( i ) < CaldTime( j )) then

    temp = CaldTime(j)
    CaldTime( j ) = CaldTime( i )
    CaldTime( i ) = temp

    End If
    Next
    Next

  2. #2
    Join Date
    Dec 2011
    Posts
    27

    Smile

    I solved this one on my own. Probably far from the most elegant, but this is what I did:

    For i = 1 to Rec_count
    For j = i to Rec_count
    if CaldTime( i ) <> "" and CaldTime( j ) <> "" then

    if( DateDiff("s",DateValue(CaldTime( i )) &" "& (FormatDateTime(CaldTime(i ),4)), DateValue(CaldTime( j)) &" "& (FormatDateTime(CaldTime(j ),4))) > 0) then

    temp = CaldTime(j)
    CaldTime( j ) = CaldTime( i )
    CaldTime( i ) = temp

    End If

    End If

    Next
    Next

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I wrote something in Access a long time ago that does something like this.

    http://www.dbforums.com/microsoft-ac...alue-list.html

    Hope this helps
    George
    Home | Blog

  4. #4
    Join Date
    Dec 2011
    Posts
    27
    Thanku dear gvee
    the link was very useful

Posting Permissions

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