PC Review


Reply
Thread Tools Rate Thread

Sort and then cut records to Cut records and then sort

 
 
Tony WONG
Guest
Posts: n/a
 
      4th Nov 2005
i have the following code to sort out the records into a text file.
********************
Set KKK = objfolder.Items
KKK.Sort "Start", False
For Each Item In KKK
If Item.Class = 26 Then
If Item.Start >= Now Or Item.End >= Now Then
With webfile
.writeline Item.Subject
End With
End If
End If
Next
********************
there are too many records in the folder now. i wish to change the code to
cut out the records first and then sort them in ascending order. i tried
out the following code but fail to item into items code. Could you give me
a hand or hints to do it? Thanks a lot.

above method : sort in ascending order first, and then cut the records out
of the date range.

below method : cut the records out of the date range, and then assign them
in a object, and then sort the items in the object in ascending order.

i think i have technical difficulties in assigned the new object at code ROW
5

**********************************
Set JJJ = objfolder.Items
For Each Item In objfolder.Items
If Item.Class = 26 Then
If Item.Start >= Now Or Item.End >= Now Then
JJJ.ItemAdd Item
End If
End If
Next
JJJ.Sort "Start", False
For Each Item In JJJ
With webfile
.writeline Item.Subject
End With
Next
*******************************


 
Reply With Quote
 
 
 
 
tony wong
Guest
Posts: n/a
 
      6th Nov 2005
pls ignore, seems not work

"Tony WONG" <(E-Mail Removed)> ¼¶¼g©ó¶l¥ó·s»D:%(E-Mail Removed)...
>i have the following code to sort out the records into a text file.
> ********************
> Set KKK = objfolder.Items
> KKK.Sort "Start", False
> For Each Item In KKK
> If Item.Class = 26 Then
> If Item.Start >= Now Or Item.End >= Now Then
> With webfile
> .writeline Item.Subject
> End With
> End If
> End If
> Next
> ********************
> there are too many records in the folder now. i wish to change the code
> to cut out the records first and then sort them in ascending order. i
> tried out the following code but fail to item into items code. Could you
> give me a hand or hints to do it? Thanks a lot.
>
> above method : sort in ascending order first, and then cut the records out
> of the date range.
>
> below method : cut the records out of the date range, and then assign them
> in a object, and then sort the items in the object in ascending order.
>
> i think i have technical difficulties in assigned the new object at code
> ROW 5
>
> **********************************
> Set JJJ = objfolder.Items
> For Each Item In objfolder.Items
> If Item.Class = 26 Then
> If Item.Start >= Now Or Item.End >= Now Then
> JJJ.ItemAdd Item
> End If
> End If
> Next
> JJJ.Sort "Start", False
> For Each Item In JJJ
> With webfile
> .writeline Item.Subject
> End With
> Next
> *******************************
>



 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      8th Nov 2005
You might want to try using the Items.Restrict method to filter the items by date. See http://www.outlookcode.com/d/finddate.htm

Also note that ItemAdd is an event, not a method.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Tony WONG" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
>i have the following code to sort out the records into a text file.
> ********************
> Set KKK = objfolder.Items
> KKK.Sort "Start", False
> For Each Item In KKK
> If Item.Class = 26 Then
> If Item.Start >= Now Or Item.End >= Now Then
> With webfile
> .writeline Item.Subject
> End With
> End If
> End If
> Next
> ********************
> there are too many records in the folder now. i wish to change the code to
> cut out the records first and then sort them in ascending order. i tried
> out the following code but fail to item into items code. Could you give me
> a hand or hints to do it? Thanks a lot.
>
> above method : sort in ascending order first, and then cut the records out
> of the date range.
>
> below method : cut the records out of the date range, and then assign them
> in a object, and then sort the items in the object in ascending order.
>
> i think i have technical difficulties in assigned the new object at code ROW
> 5
>
> **********************************
> Set JJJ = objfolder.Items
> For Each Item In objfolder.Items
> If Item.Class = 26 Then
> If Item.Start >= Now Or Item.End >= Now Then
> JJJ.ItemAdd Item
> End If
> End If
> Next
> JJJ.Sort "Start", False
> For Each Item In JJJ
> With webfile
> .writeline Item.Subject
> End With
> Next
> *******************************
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort records salim wave Microsoft Access 6 15th Jan 2009 10:50 PM
When i sort records...Only from Colomn A to O does it sort the lis =?Utf-8?B?UmFuZGFsbA==?= Microsoft Excel Misc 1 26th Oct 2006 02:19 AM
sort records =?Utf-8?B?QWxm?= Microsoft Access 2 12th Oct 2005 10:23 AM
Sort records Liz Hansen Microsoft Access Form Coding 3 6th Feb 2004 10:35 PM
Sort records by name Frank Microsoft Access 1 27th Jan 2004 10:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 AM.