Copying data between atbs in a custom form

B

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
 
M

Michael Bauer [MVP - Outlook]

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

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:5
 
M

Michael Bauer [MVP - Outlook]

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:
 
B

bear

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:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top