PC Review


Reply
Thread Tools Rate Thread

Copying data between atbs in a custom form

 
 
bear
Guest
Posts: n/a
 
      26th Mar 2010
Hello
I have a custom form. Form is a modified appointment with a second tab for a custom form.

Trying to copy data from custom form/second tab to first tab which a standard Appointment page.

First trying to make sure that a user is in a second tab which is called Transportation Form. When code is executed it should take data from some fields in Transportation Form and copy it over to Appointment tab/first tab.
Not sure how to call tabs. Any help would be appreciated


Sub Appt_From_From()
Dim txtBody1 As String
Dim txtBody2 As String
Dim txtBody3 As String
Dim objCurContact As ContactItem
Dim objAppt As AppointmentItem

Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")

On Error GoTo ErrorCode

If Application.ActiveInspector.CurrentItem.Class <> myItem Then
MsgBox "Error,exiting"
GoTo ErrorCode

Else

Set objCurContact = Application.ActiveInspector.CurrentItem
Set objAppt = myItem

 
Reply With Quote
 
 
 
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      27th Mar 2010


This calls a certain control on the names page:
dim ctrl as object
Set ctrl=
Application.ActiveInspector.ModifiedFormPages("name").Controls("name")

You don't need to create the myItem object. If you want to test, whether a
certain item uses your modified form, check its MessageClass property.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
<http://www.vboffice.net/product.html?lang=en>


Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:

> Hello
> I have a custom form. Form is a modified appointment with a second tab for

a custom form.
>
> Trying to copy data from custom form/second tab to first tab which a

standard Appointment page.
>
> First trying to make sure that a user is in a second tab which is called

Transportation Form. When code is executed it should take data from some
fields in Transportation Form and copy it over to Appointment tab/first tab.
> Not sure how to call tabs. Any help would be appreciated
>
>
> Sub Appt_From_From()
> Dim txtBody1 As String
> Dim txtBody2 As String
> Dim txtBody3 As String
> Dim objCurContact As ContactItem
> Dim objAppt As AppointmentItem
>
> Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
>
> On Error GoTo ErrorCode
>
> If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> MsgBox "Error,exiting"
> GoTo ErrorCode
>
> Else
>
> Set objCurContact = Application.ActiveInspector.CurrentItem
> Set objAppt = myItem
>
> .
> Submitted using http://www.outlookforums.com

 
Reply With Quote
 
bear
Guest
Posts: n/a
 
      29th Mar 2010
Hello


Here is what I have now and it does not seem to find the form. Not sure how it should be refrenced?

Public Sub Appt_From_Contact()

Dim txtBody1 As String
Dim txtBody2 As String
Dim txtBody3 As String
Dim objCurContact As ContactItem
Dim objAppt As AppointmentItem
Dim ins As Outlook.AppointmentItem
Dim con As Outlook.AppointmentItem
Dim ctrl As Object
On Error GoTo ErrorCode

'Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
'Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")

Set ctrl = Application.ActiveInspector.ModifiedFormPages("IPM.Appointment.Tim3.18.2010 ").Controls("DestinationandAddr").Value
If Application.ActiveInspector.CurrentItem.Class <> olAppointment Then
MsgBox "Error,exiting"
GoTo ErrorCode
Else

Set objCurContact = Application.ActiveInspector.CurrentItem
Set objAppt = Application.CreateItem(ctrl)



mb wrote on Sat, 27 March 2010 01:5
> This calls a certain control on the names page:
> dim ctrl as object
> Set ctrl=
> Application.ActiveInspector.ModifiedFormPages("name").Controls( "name")
>
> You don't need to create the myItem object. If you want to test, whether a
> certain item uses your modified form, check its MessageClass property.
>
> --
> Best regards
> Michael Bauer - MVP Outlook
> Category Manager - Manage and share your categories:
> SAM - The Sending Account Manager:
> <http://www.vboffice.net/product.html?lang=en>
>
>
> Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:
>
> > Hello
> > I have a custom form. Form is a modified appointment with a second tab for

> a custom form.
> >
> > Trying to copy data from custom form/second tab to first tab which a

> standard Appointment page.
> >
> > First trying to make sure that a user is in a second tab which is called

> Transportation Form. When code is executed it should take data from some
> fields in Transportation Form and copy it over to Appointment tab/first tab.
> > Not sure how to call tabs. Any help would be appreciated
> >
> >
> > Sub Appt_From_From()
> > Dim txtBody1 As String
> > Dim txtBody2 As String
> > Dim txtBody3 As String
> > Dim objCurContact As ContactItem
> > Dim objAppt As AppointmentItem
> >
> > Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> > Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> >
> > On Error GoTo ErrorCode
> >
> > If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> > MsgBox "Error,exiting"
> > GoTo ErrorCode
> >
> > Else
> >
> > Set objCurContact = Application.ActiveInspector.CurrentItem
> > Set objAppt = myItem
> >
> > .
> > Submitted using http://www.outlookforums.co


 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      30th Mar 2010


Dim Appt as Outlook.AppointmentItem
Dim ctrl as Object

' Assuming the current item is an appointment
Set Appt=Application.ActiveInspector.CurrentItem

if Appt.MessageClass="IPM.Appointment.Tim3.18.2010" Then
' this AppointmentItem is using your custom form
' here you should be able to access the ModifiedFormPage and the control
by their names
else
' this AppointmentItem probably is using the default form
endif

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
<http://www.vboffice.net/product.html?lang=en>


Am Mon, 29 Mar 2010 12:44:17 -0400 schrieb bear:

> Hello
>
>
> Here is what I have now and it does not seem to find the form. Not sure

how it should be refrenced?
>
> Public Sub Appt_From_Contact()
>
> Dim txtBody1 As String
> Dim txtBody2 As String
> Dim txtBody3 As String
> Dim objCurContact As ContactItem
> Dim objAppt As AppointmentItem
> Dim ins As Outlook.AppointmentItem
> Dim con As Outlook.AppointmentItem
> Dim ctrl As Object
> On Error GoTo ErrorCode
>
> 'Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> 'Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
>
> Set ctrl =

Application.ActiveInspector.ModifiedFormPages("IPM.Appointment.Tim3.18.2010
").Controls("DestinationandAddr").Value
> If Application.ActiveInspector.CurrentItem.Class <> olAppointment Then
> MsgBox "Error,exiting"
> GoTo ErrorCode
> Else
>
> Set objCurContact = Application.ActiveInspector.CurrentItem
> Set objAppt = Application.CreateItem(ctrl)
>
>
>
> mb wrote on Sat, 27 March 2010 01:57
>> This calls a certain control on the names page:
>> dim ctrl as object
>> Set ctrl=
>> Application.ActiveInspector.ModifiedFormPages("name").Controls( "name")
>>
>> You don't need to create the myItem object. If you want to test, whether

a
>> certain item uses your modified form, check its MessageClass property.
>>
>> --
>> Best regards
>> Michael Bauer - MVP Outlook
>> Category Manager - Manage and share your categories:
>> SAM - The Sending Account Manager:
>> <http://www.vboffice.net/product.html?lang=en>
>>
>>
>> Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:
>>
>>> Hello
>>> I have a custom form. Form is a modified appointment with a second tab

for
>> a custom form.
>>>
>>> Trying to copy data from custom form/second tab to first tab which a

>> standard Appointment page.
>>>
>>> First trying to make sure that a user is in a second tab which is called

>> Transportation Form. When code is executed it should take data from some
>> fields in Transportation Form and copy it over to Appointment tab/first

tab.
>>> Not sure how to call tabs. Any help would be appreciated
>>>
>>>
>>> Sub Appt_From_From()
>>> Dim txtBody1 As String
>>> Dim txtBody2 As String
>>> Dim txtBody3 As String
>>> Dim objCurContact As ContactItem
>>> Dim objAppt As AppointmentItem
>>>
>>> Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
>>> Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
>>>
>>> On Error GoTo ErrorCode
>>>
>>> If Application.ActiveInspector.CurrentItem.Class <> myItem Then
>>> MsgBox "Error,exiting"
>>> GoTo ErrorCode
>>>
>>> Else
>>>
>>> Set objCurContact = Application.ActiveInspector.CurrentItem
>>> Set objAppt = myItem
>>>
>>> .
>>> Submitted using http://www.outlookforums.com

>
> .
> Submitted using http://www.outlookforums.com

 
Reply With Quote
 
bear
Guest
Posts: n/a
 
      30th Mar 2010
Hello

I made modifications. here is what I have now and get an error -2147024809. Error comes up right after ModifiedFormPages("Transportation Form").Controls("DestinationandAddr"). Does it care that there is a space between words Transportation and Form?

Sub FormtoAppt()

Dim txtBody1 As String
Dim txtBody2 As String
Dim txtBody3 As String
Dim objCurContact As ContactItem
Dim objAppt As AppointmentItem
Dim ctrl As Object
Dim Appt As Outlook.AppointmentItem
On Error GoTo ErrorCode

Set Appt = Application.ActiveInspector.CurrentItem

If Appt.MessageClass = "IPM.Appointment.Tim3.18.2010" Then
Set ctrl = Application.ActiveInspector.ModifiedFormPages("Transportation Form").Controls("DestinationandAddr")

Set objCurContact = Application.ActiveInspector.CurrentItem
Set objAppt = Application.CreateItem(ctrl)

........................
mb wrote on Tue, 30 March 2010 02:57
> Dim Appt as Outlook.AppointmentItem
> Dim ctrl as Object
>
> ' Assuming the current item is an appointment
> Set Appt=Application.ActiveInspector.CurrentItem
>
> if Appt.MessageClass="IPM.Appointment.Tim3.18.2010" Then
> ' this AppointmentItem is using your custom form
> ' here you should be able to access the ModifiedFormPage and the control
> by their names
> else
> ' this AppointmentItem probably is using the default form
> endif
>
> --
> Best regards
> Michael Bauer - MVP Outlook
> Category Manager - Manage and share your categories:
> SAM - The Sending Account Manager:
> <http://www.vboffice.net/product.html?lang=en>
>
>
> Am Mon, 29 Mar 2010 12:44:17 -0400 schrieb bear:
>
> > Hello
> >
> >
> > Here is what I have now and it does not seem to find the form. Not sure

> how it should be refrenced?
> >
> > Public Sub Appt_From_Contact()
> >
> > Dim txtBody1 As String
> > Dim txtBody2 As String
> > Dim txtBody3 As String
> > Dim objCurContact As ContactItem
> > Dim objAppt As AppointmentItem
> > Dim ins As Outlook.AppointmentItem
> > Dim con As Outlook.AppointmentItem
> > Dim ctrl As Object
> > On Error GoTo ErrorCode
> >
> > 'Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> > 'Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> >
> > Set ctrl =

> Application.ActiveInspector.ModifiedFormPages("IPM.Appointment.Tim3.18.2010
> ").Controls("DestinationandAddr").Value
> > If Application.ActiveInspector.CurrentItem.Class <> olAppointment Then
> > MsgBox "Error,exiting"
> > GoTo ErrorCode
> > Else
> >
> > Set objCurContact = Application.ActiveInspector.CurrentItem
> > Set objAppt = Application.CreateItem(ctrl)
> >
> >
> >
> > mb wrote on Sat, 27 March 2010 01:57
> >> This calls a certain control on the names page:
> >> dim ctrl as object
> >> Set ctrl=
> >> Application.ActiveInspector.ModifiedFormPages("name").Controls( "name")
> >>
> >> You don't need to create the myItem object. If you want to test, whether

> a
> >> certain item uses your modified form, check its MessageClass property.
> >>
> >> --
> >> Best regards
> >> Michael Bauer - MVP Outlook
> >> Category Manager - Manage and share your categories:
> >> SAM - The Sending Account Manager:
> >> <http://www.vboffice.net/product.html?lang=en>
> >>
> >>
> >> Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:
> >>
> >>> Hello
> >>> I have a custom form. Form is a modified appointment with a second tab

> for
> >> a custom form.
> >>>
> >>> Trying to copy data from custom form/second tab to first tab which a
> >> standard Appointment page.
> >>>
> >>> First trying to make sure that a user is in a second tab which is called
> >> Transportation Form. When code is executed it should take data from some
> >> fields in Transportation Form and copy it over to Appointment tab/first

> tab.
> >>> Not sure how to call tabs. Any help would be appreciated
> >>>
> >>>
> >>> Sub Appt_From_From()
> >>> Dim txtBody1 As String
> >>> Dim txtBody2 As String
> >>> Dim txtBody3 As String
> >>> Dim objCurContact As ContactItem
> >>> Dim objAppt As AppointmentItem
> >>>
> >>> Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> >>> Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> >>>
> >>> On Error GoTo ErrorCode
> >>>
> >>> If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> >>> MsgBox "Error,exiting"
> >>> GoTo ErrorCode
> >>>
> >>> Else
> >>>
> >>> Set objCurContact = Application.ActiveInspector.CurrentItem
> >>> Set objAppt = myItem
> >>>
> >>> .
> >>> Submitted using http://www.outlookforums.com

> >
> > .
> > Submitted using http://www.outlookforums.com


..
Submitted using http://www.outlookforums.com
 
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
Problem copying User1 data to custom-defined field Phyllis Blans Microsoft Outlook VBA Programming 4 30th Nov 2006 12:39 AM
Copying Data form user field to custom field abrobins@gmail.com Microsoft Outlook Contacts 1 4th Sep 2006 06:32 PM
Copying custom control from one form to another during runtime =?Utf-8?B?QWxCcnVBbg==?= Microsoft Dot NET Framework Forms 0 15th Dec 2004 08:37 PM
Custom Views missing custom form data when deployed Tomk Microsoft Outlook Form Programming 4 23rd Apr 2004 07:05 PM
Custom Views missing custom form data when deployed Tomk Microsoft Outlook Form Programming 0 22nd Apr 2004 06:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:50 AM.