![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I have several public task folders from which I would like to import the
task information into Access including some form data. I've tried the table linking deal but it doesn't include the start date and other form data. I know the EntryIDs and StoreIDs but can't figure out how to make it import. Any ideas? Here's my current code: ' Set up DAO objects (uses existing "tblTasks" table) Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("tblTasks") ' Set up Outlook objects. Dim ol As New Outlook.Application Dim olns As Outlook.NameSpace Dim cf As Outlook.MAPIFolder Dim c As Outlook.TaskItem Dim objItems As Outlook.Items Dim Prop As Outlook.UserProperty Dim txtEntryID, txtStoreID txtEntryID = Screen.ActiveForm.ENTRYID txtStoreID = Screen.ActiveForm.STOREID Set olns = ol.GetNamespace("MAPI") Set cf = olns.GetFolderFromID(txtEntryID, txtStoreID) Set objItems = cf.Items iNumTasks = objItems.Count If iNumTasks 0 Then For i = 1 To iNumTasks If TypeName(objItems(i)) = "TaskItem" Then Set c = objItems(i) rst.AddNew rst!TASK = c.Subject rst!DueDate = c.DueDate rst!STARTDATE = c.STARTDATE rst!Status = c.Status rst!Rec = c.IsRecurring rst!SECTION = Screen.ActiveForm.DutySection rst!Remarks = c.Body rst.Update End If Next i rst.Close End If After the last rst! I would like to add a reference to a field on a custom tab: (There's the 'TASK' tab and 'MY TAB') rst!EQUIPID = c.MyCustomTab.EQUIPID (or whatever will work) Any ideas? |
#2
|
|||
|
|||
![]()
If you want access to any custom fields you've created, you can get at them
via the TaskItem.UserProperties collection. To get a UserProperty object: Dim objUP As UserProperty Set objUP = myTaskItem.UserProperties("MyCustomFieldName") Debug.Print objUP.Value Does that answer your question? -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Donald Fisher" wrote: I have several public task folders from which I would like to import the task information into Access including some form data. I've tried the table linking deal but it doesn't include the start date and other form data. I know the EntryIDs and StoreIDs but can't figure out how to make it import. Any ideas? Here's my current code: ' Set up DAO objects (uses existing "tblTasks" table) Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("tblTasks") ' Set up Outlook objects. Dim ol As New Outlook.Application Dim olns As Outlook.NameSpace Dim cf As Outlook.MAPIFolder Dim c As Outlook.TaskItem Dim objItems As Outlook.Items Dim Prop As Outlook.UserProperty Dim txtEntryID, txtStoreID txtEntryID = Screen.ActiveForm.ENTRYID txtStoreID = Screen.ActiveForm.STOREID Set olns = ol.GetNamespace("MAPI") Set cf = olns.GetFolderFromID(txtEntryID, txtStoreID) Set objItems = cf.Items iNumTasks = objItems.Count If iNumTasks 0 Then For i = 1 To iNumTasks If TypeName(objItems(i)) = "TaskItem" Then Set c = objItems(i) rst.AddNew rst!TASK = c.Subject rst!DueDate = c.DueDate rst!STARTDATE = c.STARTDATE rst!Status = c.Status rst!Rec = c.IsRecurring rst!SECTION = Screen.ActiveForm.DutySection rst!Remarks = c.Body rst.Update End If Next i rst.Close End If After the last rst! I would like to add a reference to a field on a custom tab: (There's the 'TASK' tab and 'MY TAB') rst!EQUIPID = c.MyCustomTab.EQUIPID (or whatever will work) Any ideas? |
#3
|
|||
|
|||
![]()
And how would I list everything in the userproperties collection? I
don't know what some of the custom field names are and design view of the form has been password protected. Eric Legault [MVP - Outlook] wrote: If you want access to any custom fields you've created, you can get at them via the TaskItem.UserProperties collection. To get a UserProperty object: Dim objUP As UserProperty Set objUP = myTaskItem.UserProperties("MyCustomFieldName") Debug.Print objUP.Value Does that answer your question? |
#4
|
|||
|
|||
![]()
You can loop through all custom fields programmatically by iterating through
the UserProperties collection: For intX = 1 To MyTaskItem.UserProperties.Count Set objUP = MyTaskItem.UserProperties.Item(intX) Debug.Print "Field Name: " & objUP.Name & "; Value: " & objUP.Value Next You can also see these in the folder where the form is published. Bring up the Field Chooser dialog and see if the form name is listed in the dropdown. If not, browse the list and select Forms... and add your form to the folder. You can then select the form name and see the list of fields. -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Donald Fisher" wrote: And how would I list everything in the userproperties collection? I don't know what some of the custom field names are and design view of the form has been password protected. Eric Legault [MVP - Outlook] wrote: If you want access to any custom fields you've created, you can get at them via the TaskItem.UserProperties collection. To get a UserProperty object: Dim objUP As UserProperty Set objUP = myTaskItem.UserProperties("MyCustomFieldName") Debug.Print objUP.Value Does that answer your question? |
#5
|
|||
|
|||
![]()
Great! Didn't realize the Field Chooser could do that. Thanks!
Eric Legault [MVP - Outlook] wrote: You can loop through all custom fields programmatically by iterating through the UserProperties collection: For intX = 1 To MyTaskItem.UserProperties.Count Set objUP = MyTaskItem.UserProperties.Item(intX) Debug.Print "Field Name: " & objUP.Name & "; Value: " & objUP.Value Next You can also see these in the folder where the form is published. Bring up the Field Chooser dialog and see if the form name is listed in the dropdown. If not, browse the list and select Forms... and add your form to the folder. You can then select the form name and see the list of fields. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Import Outlook Task Form Data Into Access | Donald Fisher | Outlook - General Queries | 2 | August 15th 07 04:52 PM |
form data in outlook web access | JP | Outlook - Using Forms | 2 | May 11th 07 07:03 AM |
Import data from MS Access into Outlook | JRSNHECI | Outlook - Using Contacts | 0 | January 16th 07 06:43 PM |
Customized Task form not saving data | RClauss | Outlook - Using Forms | 3 | October 25th 06 04:46 PM |
getting data from Access Database in Outlook Form | Weatherman | Outlook - Calandaring | 1 | April 17th 06 02:49 PM |