Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Outlk 2k3 Script: Find and findNext use (http://www.outlookbanter.com/outlook-vba/33446-outlk-2k3-script-find-findnext.html)

news.microsoft.com November 21st 06 10:24 AM

Outlk 2k3 Script: Find and findNext use
 
Hi all,

I try to use the find funtion comapring 2 properties

I want to add to my listbox all items that mileage
is greater than 50000 at a specific day then pb is
that ceationtime is like dd/mm/yyyy hh:mm:ss
so i want to use date() function to convert the
creationtime to dd/mm/yyyu

item.mileage Var1 and the item.creationtime= Var2

set myItem = Items.Find("[mileage] """ & myvar1 & """ and
date(myitem.creationtime) = """ & myVar2"""")

I tryed many sintax but no one work

tks for help



Ken Slovak - [MVP - Outlook] November 21st 06 02:44 PM

Outlk 2k3 Script: Find and findNext use
 
The Date function either sets or retrieves the system date. It doesn't do
anything close to what you want to do. You also can't use seconds in a Find
or Restrict.

The Help on Items.Restrict lists all the properties you can't use for a
filter and shows some pretty good examples of filters you can use. For what
you want it probably would be something like:

sFilter = "[Mileage] " & Var1
sFilter = sFilter & " And [CreationTime] = '" & Format(Var2, "ddddd h:nn
AMPM") & "'"
Set myItem = Items.Find(sFilter)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"news.microsoft.com" wrote in message
...
Hi all,

I try to use the find funtion comapring 2 properties

I want to add to my listbox all items that mileage
is greater than 50000 at a specific day then pb is
that ceationtime is like dd/mm/yyyy hh:mm:ss
so i want to use date() function to convert the
creationtime to dd/mm/yyyu

item.mileage Var1 and the item.creationtime= Var2

set myItem = Items.Find("[mileage] """ & myvar1 & """ and
date(myitem.creationtime) = """ & myVar2"""")

I tryed many sintax but no one work

tks for help





All times are GMT +1. The time now is 06:42 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com