PC Review


Reply
Thread Tools Rate Thread

Event handling and conflicts in updating a CDO property

 
 
darhelger
Guest
Posts: n/a
 
      5th Nov 2004
I'm using CDO to update the "Flag for Follow Up" properties in a custom
contact form in a public folder.
After the update, I even close the item, dereference it, and reopen it to
make sure that any subsequent
changes made by the user don't cause conflicting edits. This works just fine
if I invoke the macro from
the VBA window, via Tools-->Macro, or hand build a toolbar button.

However, if I use the code below to create a new button in a new toolbar,
and click on the button to
fire the macro, I get conflicting edits. The information store is getting
updated (I can see the new values
in the folder view), but the update is not displayed in the item view. If
the user then makes a change to
the item and saves it, it causes conflicting edits, one item with the
original Due By date and other
Follow Up Flag information and the user's edits, the other item with the
updated flag information and
no new edits. (A Save & Close without a subsequent edit doesn't cause a
conflicting edit.)

I suspect the problem has to do with the event handling. Is the menu bar
code capturing a
PropertyChange event, and somehow impacting the display of the item? If so,
how do I resolve?
If not, what else could be causing this behavior?

Here's the toolbar code:

Function CreateCRMfuToolbar() As Office.CommandBar

Dim objApp As Outlook.Application
Dim objCBs As Office.CommandBars
Dim objCB As Office.CommandBar
Dim objCBControls As Office.CommandBarControls
Dim objControl As Office.CommandBarControl
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set objCBs = objApp.ActiveInspector.CommandBars
Set objCB = objCBs.Add("FollowUpBar", msoBarFloating)

objCB.Visible = True

Set objControl = objCBControls.Add(msoControlButton)
With objControl
.AddItem
.Caption = "SetNextFUDate"
.FaceId = 33
.OnAction = "setNextFUDate"
.Style = msoButtonIconAndCaption
.TooltipText = "Set Next Follow Up Date"
.Visible = True
End With

Set objControl = Nothing
Set objCBControls = Nothing
Set objCB = Nothing
Set objCBs = Nothing
Set objApp = Nothing

End Function

Many thanks,

DArhelger


 
Reply With Quote
 
 
 
 
Michael Bauer
Guest
Posts: n/a
 
      5th Nov 2004
What happens if you click on your code-builded button? Did you check if
your macro starts?

> Dim objControl As Office.CommandBarControl


For receiving the click events you need to declare the variable
"WithEvents" in the head of your form and you need to declare it as
CommandBarButton, because the -Control doesn´t fire any event.

--
Viele Grüße
Michael Bauer


"darhelger" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm using CDO to update the "Flag for Follow Up" properties in a

custom
> contact form in a public folder.
> After the update, I even close the item, dereference it, and reopen it

to
> make sure that any subsequent
> changes made by the user don't cause conflicting edits. This works

just fine
> if I invoke the macro from
> the VBA window, via Tools-->Macro, or hand build a toolbar button.
>
> However, if I use the code below to create a new button in a new

toolbar,
> and click on the button to
> fire the macro, I get conflicting edits. The information store is

getting
> updated (I can see the new values
> in the folder view), but the update is not displayed in the item view.

If
> the user then makes a change to
> the item and saves it, it causes conflicting edits, one item with the
> original Due By date and other
> Follow Up Flag information and the user's edits, the other item with

the
> updated flag information and
> no new edits. (A Save & Close without a subsequent edit doesn't cause

a
> conflicting edit.)
>
> I suspect the problem has to do with the event handling. Is the menu

bar
> code capturing a
> PropertyChange event, and somehow impacting the display of the item?

If so,
> how do I resolve?
> If not, what else could be causing this behavior?
>
> Here's the toolbar code:
>
> Function CreateCRMfuToolbar() As Office.CommandBar
>
> Dim objApp As Outlook.Application
> Dim objCBs As Office.CommandBars
> Dim objCB As Office.CommandBar
> Dim objCBControls As Office.CommandBarControls
> Dim objControl As Office.CommandBarControl
> On Error Resume Next
> Set objApp = CreateObject("Outlook.Application")
> Set objCBs = objApp.ActiveInspector.CommandBars
> Set objCB = objCBs.Add("FollowUpBar", msoBarFloating)
>
> objCB.Visible = True
>
> Set objControl = objCBControls.Add(msoControlButton)
> With objControl
> .AddItem
> .Caption = "SetNextFUDate"
> .FaceId = 33
> .OnAction = "setNextFUDate"
> .Style = msoButtonIconAndCaption
> .TooltipText = "Set Next Follow Up Date"
> .Visible = True
> End With
>
> Set objControl = Nothing
> Set objCBControls = Nothing
> Set objCB = Nothing
> Set objCBs = Nothing
> Set objApp = Nothing
>
> End Function
>
> Many thanks,
>
> DArhelger
>
>


 
Reply With Quote
 
darhelger
Guest
Posts: n/a
 
      5th Nov 2004
Yes, the macro starts and runs to completion. All the click event has to do
is run the macro, which it does.

What I suspect is that adding the additional event handling layer of the
custom button somehow mucking with the item refresh so the property change
doesn't get displayed (although it is stored).

DArhelger

"Michael Bauer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What happens if you click on your code-builded button? Did you check if
> your macro starts?
>
>> Dim objControl As Office.CommandBarControl

>
> For receiving the click events you need to declare the variable
> "WithEvents" in the head of your form and you need to declare it as
> CommandBarButton, because the -Control doesn´t fire any event.
>
> --
> Viele Grüße
> Michael Bauer
>
>
> "darhelger" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I'm using CDO to update the "Flag for Follow Up" properties in a

> custom
>> contact form in a public folder.
>> After the update, I even close the item, dereference it, and reopen it

> to
>> make sure that any subsequent
>> changes made by the user don't cause conflicting edits. This works

> just fine
>> if I invoke the macro from
>> the VBA window, via Tools-->Macro, or hand build a toolbar button.
>>
>> However, if I use the code below to create a new button in a new

> toolbar,
>> and click on the button to
>> fire the macro, I get conflicting edits. The information store is

> getting
>> updated (I can see the new values
>> in the folder view), but the update is not displayed in the item view.

> If
>> the user then makes a change to
>> the item and saves it, it causes conflicting edits, one item with the
>> original Due By date and other
>> Follow Up Flag information and the user's edits, the other item with

> the
>> updated flag information and
>> no new edits. (A Save & Close without a subsequent edit doesn't cause

> a
>> conflicting edit.)
>>
>> I suspect the problem has to do with the event handling. Is the menu

> bar
>> code capturing a
>> PropertyChange event, and somehow impacting the display of the item?

> If so,
>> how do I resolve?
>> If not, what else could be causing this behavior?
>>
>> Here's the toolbar code:
>>
>> Function CreateCRMfuToolbar() As Office.CommandBar
>>
>> Dim objApp As Outlook.Application
>> Dim objCBs As Office.CommandBars
>> Dim objCB As Office.CommandBar
>> Dim objCBControls As Office.CommandBarControls
>> Dim objControl As Office.CommandBarControl
>> On Error Resume Next
>> Set objApp = CreateObject("Outlook.Application")
>> Set objCBs = objApp.ActiveInspector.CommandBars
>> Set objCB = objCBs.Add("FollowUpBar", msoBarFloating)
>>
>> objCB.Visible = True
>>
>> Set objControl = objCBControls.Add(msoControlButton)
>> With objControl
>> .AddItem
>> .Caption = "SetNextFUDate"
>> .FaceId = 33
>> .OnAction = "setNextFUDate"
>> .Style = msoButtonIconAndCaption
>> .TooltipText = "Set Next Follow Up Date"
>> .Visible = True
>> End With
>>
>> Set objControl = Nothing
>> Set objCBControls = Nothing
>> Set objCB = Nothing
>> Set objCBs = Nothing
>> Set objApp = Nothing
>>
>> End Function
>>
>> Many thanks,
>>
>> DArhelger
>>
>>

>



 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      6th Nov 2004
Sorry, my fault, I can´t help you.

I have read your posting yesterday a few times, this morning again but I
don´t understand the context. :-(

--
Viele Grüße
Michael Bauer


"darhelger" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, the macro starts and runs to completion. All the click event has

to do
> is run the macro, which it does.
>
> What I suspect is that adding the additional event handling layer of

the
> custom button somehow mucking with the item refresh so the property

change
> doesn't get displayed (although it is stored).
>
> DArhelger
>
> "Michael Bauer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > What happens if you click on your code-builded button? Did you check

if
> > your macro starts?
> >
> >> Dim objControl As Office.CommandBarControl

> >
> > For receiving the click events you need to declare the variable
> > "WithEvents" in the head of your form and you need to declare it as
> > CommandBarButton, because the -Control doesn´t fire any event.
> >
> > --
> > Viele Grüße
> > Michael Bauer
> >
> >
> > "darhelger" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> I'm using CDO to update the "Flag for Follow Up" properties in a

> > custom
> >> contact form in a public folder.
> >> After the update, I even close the item, dereference it, and reopen

it
> > to
> >> make sure that any subsequent
> >> changes made by the user don't cause conflicting edits. This works

> > just fine
> >> if I invoke the macro from
> >> the VBA window, via Tools-->Macro, or hand build a toolbar button.
> >>
> >> However, if I use the code below to create a new button in a new

> > toolbar,
> >> and click on the button to
> >> fire the macro, I get conflicting edits. The information store is

> > getting
> >> updated (I can see the new values
> >> in the folder view), but the update is not displayed in the item

view.
> > If
> >> the user then makes a change to
> >> the item and saves it, it causes conflicting edits, one item with

the
> >> original Due By date and other
> >> Follow Up Flag information and the user's edits, the other item

with
> > the
> >> updated flag information and
> >> no new edits. (A Save & Close without a subsequent edit doesn't

cause
> > a
> >> conflicting edit.)
> >>
> >> I suspect the problem has to do with the event handling. Is the

menu
> > bar
> >> code capturing a
> >> PropertyChange event, and somehow impacting the display of the

item?
> > If so,
> >> how do I resolve?
> >> If not, what else could be causing this behavior?
> >>
> >> Here's the toolbar code:
> >>
> >> Function CreateCRMfuToolbar() As Office.CommandBar
> >>
> >> Dim objApp As Outlook.Application
> >> Dim objCBs As Office.CommandBars
> >> Dim objCB As Office.CommandBar
> >> Dim objCBControls As Office.CommandBarControls
> >> Dim objControl As Office.CommandBarControl
> >> On Error Resume Next
> >> Set objApp = CreateObject("Outlook.Application")
> >> Set objCBs = objApp.ActiveInspector.CommandBars
> >> Set objCB = objCBs.Add("FollowUpBar", msoBarFloating)
> >>
> >> objCB.Visible = True
> >>
> >> Set objControl = objCBControls.Add(msoControlButton)
> >> With objControl
> >> .AddItem
> >> .Caption = "SetNextFUDate"
> >> .FaceId = 33
> >> .OnAction = "setNextFUDate"
> >> .Style = msoButtonIconAndCaption
> >> .TooltipText = "Set Next Follow Up Date"
> >> .Visible = True
> >> End With
> >>
> >> Set objControl = Nothing
> >> Set objCBControls = Nothing
> >> Set objCB = Nothing
> >> Set objCBs = Nothing
> >> Set objApp = Nothing
> >>
> >> End Function
> >>
> >> Many thanks,
> >>
> >> DArhelger
> >>
> >>

> >

>
>


 
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
Handling posible update conflicts Finn Stampe Mikkelsen Microsoft ASP .NET 0 25th Aug 2010 11:56 PM
Event Conflicts KGlennC Microsoft Outlook Discussion 2 5th Aug 2008 01:41 PM
Handling Concurrency Conflicts =?Utf-8?B?QmFoZXJp?= Microsoft ASP .NET 0 10th Nov 2006 11:02 AM
Custom Event handling + thread handling. Michael McCarthy Microsoft C# .NET 1 14th Jun 2005 03:50 AM
Enabled property conflicts with ViewState? Cipher Microsoft ASP .NET 3 30th Apr 2004 05:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 PM.