Populate task field based on value of other field

  • Thread starter Thread starter anBhcmtlcg
  • Start date Start date
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.
 
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.
>
 
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.
> >


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

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

> >


>
 
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
B Outlook 365 Populate Outlook Task UDFs from a UDF text string Outlook VBA and Custom Forms 2
C Populate form data into message body Outlook VBA and Custom Forms 1
cbufacchi Outlook 365 Populate custom Outlook Appoint form Outlook VBA and Custom Forms 2
D Cannot populate certain UserProperties in Outlook from Excel Outlook VBA and Custom Forms 2
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 Using Outlook 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
sjbtax Update Task Custom Field based upon Task Overdue Status Outlook VBA and Custom Forms 8
B Requesting VBA code to make Outlook prompt for confirmation when deleting a task? Outlook VBA and Custom Forms 4
T Why do Outlook Desktop 2021 tasks from my wife's email show up in my task pane? Using Outlook 2
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
K Daily Task List Minimized Cannot Display Using Outlook 5
wayneame Changing the Form Used by Existing Task Items in a Folder Outlook VBA and Custom Forms 4
S Outlook 2016 Understand and customize prepended behavior of recurring task Using Outlook 0
K Multiple copies of task being created Using Outlook 2
P Short Date Format when typing in a task Using Outlook 2
C Outlook 2013 Task Recurrence - Third Friday After the Second Tuesday Using Outlook 2
P Task display now leaves little room for notes Using Outlook 10
C-S-R How to clear an Outlook (To Do) Task Flag? Using Outlook 8
G Event when creating task from mailitem Outlook VBA and Custom Forms 2
P Changing the font that the task view shows Using Outlook 5
D How To Combine Share Task Folders in just one Folder Using Outlook 0
P Can I create a Rule that sends me an email when I get a Task? Using Outlook 2
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

Similar threads

Back
Top