A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Populate task field based on value of other field



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 10th 09, 08:41 PM posted to microsoft.public.outlook.program_vba
JParker
external usenet poster
 
Posts: 6
Default Populate task field based on value of other field

Hi all,

I'd like to automatically populate a custom task field based on the value of
another field.

Specifically, I basically want this to happen when creating or modifying a
task:
if "Due Date" == None {
"Due Date Exists" = No;
}

So then I can sort based on this field.

Any suggestions on how to get started? How do I go about creating the code
to do this? I'm just looking for a kick in the right direction here.

Thanks.

Ads
  #2  
Old March 11th 09, 01:42 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Populate task field based on value of other field

Where is this code supposed to run, a COM addin or a custom form or ...?

A null Date value in Outlook is 1/1/4501, that's what you have to check for.

If "Due Date Exists" is a UserProperty you added then you access it as
follows, assuming "item" is the item in question:

item.UserProperties.Item("Due Date Exists") ' VBA code, syntax will vary
by language

To access the DueDate property would be item.DueDate.

Of course since all non-set date fields are 1/1/4501 you could just sort by
DueDate and those items would be either at the top or bottom of your
collection depending on if you sorted the collection in ascending or
descending order.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
Hi all,

I'd like to automatically populate a custom task field based on the value
of
another field.

Specifically, I basically want this to happen when creating or modifying a
task:
if "Due Date" == None {
"Due Date Exists" = No;
}

So then I can sort based on this field.

Any suggestions on how to get started? How do I go about creating the code
to do this? I'm just looking for a kick in the right direction here.

Thanks.


  #3  
Old March 11th 09, 03:54 PM posted to microsoft.public.outlook.program_vba
JParker
external usenet poster
 
Posts: 6
Default Populate task field based on value of other field

Hi Ken, thanks for the reply.

I'm trying to sort my Task list by due date, with No Date tasks at the
bottom (since they're unconstrained).

I've only been able to come up with the following options sorting by due date:

No date
Today
Tomorrow
....

or

....
Tomorrow
Today
No Date

I want this:
Today
Tomorrow
....
No Date

My solution was to add a user-defined field that's set to true if a due date
exists and false if it doesn't, and I could sort by that field first, then
due date second.

Is there a better way?

Thanks,
Joel


"Ken Slovak - [MVP - Outlook]" wrote:

Where is this code supposed to run, a COM addin or a custom form or ...?

A null Date value in Outlook is 1/1/4501, that's what you have to check for.

If "Due Date Exists" is a UserProperty you added then you access it as
follows, assuming "item" is the item in question:

item.UserProperties.Item("Due Date Exists") ' VBA code, syntax will vary
by language

To access the DueDate property would be item.DueDate.

Of course since all non-set date fields are 1/1/4501 you could just sort by
DueDate and those items would be either at the top or bottom of your
collection depending on if you sorted the collection in ascending or
descending order.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
Hi all,

I'd like to automatically populate a custom task field based on the value
of
another field.

Specifically, I basically want this to happen when creating or modifying a
task:
if "Due Date" == None {
"Due Date Exists" = No;
}

So then I can sort based on this field.

Any suggestions on how to get started? How do I go about creating the code
to do this? I'm just looking for a kick in the right direction here.

Thanks.



  #4  
Old March 11th 09, 08:09 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Populate task field based on value of other field

Based on how you want items to sort you'd have to sort on your user property
value unless you first used a restricted Items collection, which probably
would be the better way.

What you do is get your Items collection and call the Restrict method on it,
filtering out any items that have DueDate = #1/1/4501#. The new Items
collection returned by the Restrict method would then contain no items
without a DueDate and could be sorted up or down as you chose.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
Hi Ken, thanks for the reply.

I'm trying to sort my Task list by due date, with No Date tasks at the
bottom (since they're unconstrained).

I've only been able to come up with the following options sorting by due
date:

No date
Today
Tomorrow
...

or

...
Tomorrow
Today
No Date

I want this:
Today
Tomorrow
...
No Date

My solution was to add a user-defined field that's set to true if a due
date
exists and false if it doesn't, and I could sort by that field first, then
due date second.

Is there a better way?

Thanks,
Joel


  #5  
Old March 11th 09, 08:29 PM posted to microsoft.public.outlook.program_vba
JParker
external usenet poster
 
Posts: 6
Default Populate task field based on value of other field

Ken,

Sorry, I'm not very experienced with Outlook other than using it day-to-day.

How do I use this restricted Items collection you speak of, and would it
allow me to sort based on date while ignoring No Date entries, but still
display the No Date tasks at the bottom? Or would it hide them for good?

The gist of my original question is the same as the one in your response: I
don't know where my code would go or how it would need to get run. Do use my
custom field, I'm guessing I'd need to populate it when any task was created
or modified, but I have no info other than that.

Thanks,
Joel


"Ken Slovak - [MVP - Outlook]" wrote:

Based on how you want items to sort you'd have to sort on your user property
value unless you first used a restricted Items collection, which probably
would be the better way.

What you do is get your Items collection and call the Restrict method on it,
filtering out any items that have DueDate = #1/1/4501#. The new Items
collection returned by the Restrict method would then contain no items
without a DueDate and could be sorted up or down as you chose.


  #6  
Old March 11th 09, 09:54 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Populate task field based on value of other field

The restricted collection I was talking about would not have any items with
no due date.

Even with your user property I don't think you can end up sorting the way
you want. You'd have to see.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
Ken,

Sorry, I'm not very experienced with Outlook other than using it
day-to-day.

How do I use this restricted Items collection you speak of, and would it
allow me to sort based on date while ignoring No Date entries, but still
display the No Date tasks at the bottom? Or would it hide them for good?

The gist of my original question is the same as the one in your response:
I
don't know where my code would go or how it would need to get run. Do use
my
custom field, I'm guessing I'd need to populate it when any task was
created
or modified, but I have no info other than that.

Thanks,
Joel


  #7  
Old March 11th 09, 10:03 PM posted to microsoft.public.outlook.program_vba
JParker
external usenet poster
 
Posts: 6
Default Populate task field based on value of other field

Going back to my original question, where would I put this code such that it
would populate my user field every time a task is created/modified?

Thanks,
Joel


"Ken Slovak - [MVP - Outlook]" wrote:

The restricted collection I was talking about would not have any items with
no due date.

Even with your user property I don't think you can end up sorting the way
you want. You'd have to see.


  #8  
Old March 12th 09, 02:55 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Populate task field based on value of other field

In the form select the Properties for your user field and go to the Value
tab. You can use the formula builder there to set up your condition. Set the
calculation to be automatic and set up the formula something like this:

IIf( [Due Date] = #1/1/4501# , [Due Date Exists] = No, [Due Date Exists] =
Yes )

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
Going back to my original question, where would I put this code such that
it
would populate my user field every time a task is created/modified?

Thanks,
Joel


"Ken Slovak - [MVP - Outlook]" wrote:

The restricted collection I was talking about would not have any items
with
no due date.

Even with your user property I don't think you can end up sorting the way
you want. You'd have to see.



  #9  
Old March 12th 09, 03:16 PM posted to microsoft.public.outlook.program_vba
JParker
external usenet poster
 
Posts: 6
Default Populate task field based on value of other field

I would have to design a custom Task form? There's no way to add my field
behind the scenes while using the existing Task form, or hook into it
somehow? Would this replace the default Task form? What would happen with
tasks created automatically through other apps (through COM)?

Thanks,
Joel


"Ken Slovak - [MVP - Outlook]" wrote:

In the form select the Properties for your user field and go to the Value
tab. You can use the formula builder there to set up your condition. Set the
calculation to be automatic and set up the formula something like this:

IIf( [Due Date] = #1/1/4501# , [Due Date Exists] = No, [Due Date Exists] =
Yes )

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
Going back to my original question, where would I put this code such that
it
would populate my user field every time a task is created/modified?

Thanks,
Joel


"Ken Slovak - [MVP - Outlook]" wrote:

The restricted collection I was talking about would not have any items
with
no due date.

Even with your user property I don't think you can end up sorting the way
you want. You'd have to see.




  #10  
Old March 12th 09, 03:50 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Populate task field based on value of other field

If you want that you either need a custom form or you need to write code in
the Outlook VBA project to populate your UserProperty based on the DueDate.
In that case the formula would be different. You'd also have to manage not
only any task when it was opened but also when it is selected in a folder
view and modified using in-cell editing.

It's likely that custom task forms might not be compatible with other
applications.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"jparker" wrote in message
...
I would have to design a custom Task form? There's no way to add my field
behind the scenes while using the existing Task form, or hook into it
somehow? Would this replace the default Task form? What would happen with
tasks created automatically through other apps (through COM)?

Thanks,
Joel


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2002 To field won't populate framer Outlook - General Queries 1 July 22nd 08 04:44 AM
how do i automaticlly populate the from field? Marcos Outlook - Using Forms 2 January 15th 08 06:33 PM
Populate Message field based on custom field Kryer Outlook - Using Forms 8 September 7th 07 10:19 PM
Automatically populate a field in Outlook Joe Outlook - Using Forms 1 March 22nd 06 09:23 PM
Populate Company field from Contact field in custom task form Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 07:37 PM


All times are GMT +1. The time now is 07:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.