Populate task field based on value of other field

Status
Not open for further replies.
A

anBhcmtlcg

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.
 
K

Ken Slovak - [MVP - Outlook]

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.

"jparker" <jparker> wrote in message

news:27564199-F23F-42F6-89E5-F103FAB96693@microsoft.com...
> 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.
>
 
A

anBhcmtlcg

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
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.

> >

>

> "jparker" <jparker> wrote in message
> news:27564199-F23F-42F6-89E5-F103FAB96693@microsoft.com...
> > 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.
> >


>
 
K

Ken Slovak - [MVP - Outlook]

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.

"jparker" <jparker> wrote in message

news:ED47E8C0-12F4-4CB0-A06C-C29F33214B98@microsoft.com...
> 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
 
A

anBhcmtlcg

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
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.
 
K

Ken Slovak - [MVP - Outlook]

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.

"jparker" <jparker> wrote in message

news:C38918F8-BE6F-47B0-92B2-370C4A5606B4@microsoft.com...
> 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
 
A

anBhcmtlcg

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
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.
 
K

Ken Slovak - [MVP - Outlook]

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 )

"jparker" <jparker> wrote in message

news:15E2BF5A-85EE-4041-A200-D4E0AD3F7ABD@microsoft.com...
> 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

> " - " 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.

>
 
A

anBhcmtlcg

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
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 )

> >

>

> "jparker" <jparker> wrote in message
> news:15E2BF5A-85EE-4041-A200-D4E0AD3F7ABD@microsoft.com...
> > 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
> > " - " 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.

> >


>
 
K

Ken Slovak - [MVP - Outlook]

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.

"jparker" <jparker> wrote in message

news:129D03EB-561B-44FA-B809-E0C0BF1F6710@microsoft.com...
> 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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
C Trying to populate an appointment ComboBox from Excel Outlook VBA and Custom Forms 2
A Populate Listbox from Txt File Outlook VBA and Custom Forms 0
A Populate Textbox from Txt File Outlook VBA and Custom Forms 1
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
Diane Poremsky Outlook VBA: Use a Text File to Populate a ListBox New Slipstick.com Articles 0
T populate calendar with appointments and send reminders Using Outlook 1
A Populate Excel from Outlook Userform Outlook VBA and Custom Forms 3
J Live Meeting Location populate from body Outlook VBA and Custom Forms 4
A How can I populate a dropdown list? BCM (Business Contact Manager) 4
rohit I want to Populate Popup box while sending any email with attachment. Outlook VBA and Custom Forms 4
rohit I want to Populate Popup box while sending any email with attachment Using Outlook 1
A Cannot populate IMAP folders Using Outlook 1
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
S Populate textbox values from one form to another form. Using Outlook 0
B Auto Populate From Field Using Outlook 3
G Populate an Outlook 2007 template with spreadsheet data. Outlook VBA and Custom Forms 1
R Populate Form with appointments from Calendar Outlook VBA and Custom Forms 1
J populate word template from Outlook custom form Outlook VBA and Custom Forms 2
G Populate BCC field with all Contacts within a Contact Folder Outlook VBA and Custom Forms 4
M Create new Contacts folder and populate it from Access Outlook VBA and Custom Forms 1
A Macro - Open new message, populate from and subject fields, and message text Outlook VBA and Custom Forms 1
G Macro: Create New Message and Auto populate To Field Outlook VBA and Custom Forms 5
S populate body with Word data Outlook VBA and Custom Forms 7
L how to populate multiple users contacts Outlook VBA and Custom Forms 9
G Arggh, weakness of reminder for every Task recurrence Using Outlook 0
P Can't paste an image into a task Using Outlook 3
F Validation on custom task form after task acceptance Outlook VBA and Custom Forms 1
J Office 365 erased all of my task views Using Outlook 3
T Report For Task Recurrance Outlook VBA and Custom Forms 4
E Can't accept or decline task (no button appears) Using Outlook 2
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
B Task Filter Not Working When I add too many criteria Using Outlook 0
X If you change expiration date of repeated task it dupplicates Using Outlook 1
B How to show concatenated categories in list task view? Using Outlook 2
B VBA to Collapse Task Folder Groups Outlook VBA and Custom Forms 1
E To convert imported data to custom fields in Task list Outlook VBA and Custom Forms 1
I Help with dates in task list. Using Outlook 5
Y Outlook Task View - Table Format - Customize Reminder Time to Drop-Down Selection Using Outlook 2
M Daily Task List Minimized Cannot Display Using Outlook 2
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
P Add a contact to the New Task in Outlook 2016 Using Outlook 2
S Codes for "Mark Complete" the task Outlook VBA and Custom Forms 2
W Deleting Sent Task Email, Deletes the task from my list Using Outlook 1
K Task priority modification Using Outlook 4
F Search folder for tasks in all task folders Using Outlook 1
JohnViuf Export task list view settings to other pc Outlook VBA and Custom Forms 16
V Changing default date for task follow-up buttons Using Outlook 2
K outlook workflow: automated task generation Outlook VBA and Custom Forms 4
U HTML Task Alternate Home Page View Control Using Outlook 3

Similar threads

Top