![]() |
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
|
|||
|
|||
![]()
greetings.
current state of the union: userdefined fields have been added to custom Outlook forms and are being accessed and maintained by way of a dll with those forms Project information (such as Project ID number, Project Name, etc) can be associated with a particular Outlook item. in most items the item ![]() individual piece of info has a userdefined field in the form and published in the folder, except for the Contacts , where the association is n:n .in ordert to accomodate that a different field was created that stores the project information in a structured , delimited format and updates it according to user input. in oder to take advantage of this information i created a VB form and added an Outlook ViewCtl item to it. the idea was that the user can pick a certain Project beforehand and use buttons on the form to switch between folders which would only show the contents that applied to the previously defined project. the criteria by which would be decided what items would be shown was the ProjectID and the folder which were to be applied to the ViewCtl were known (ie. always the same folders). 4 of the 6 folders have the "ProjectID" field, the other 2 have the "info" field that contains the delimited string (which can contain 1 or more instances of a ProjectID) upon selection of a button the .Folder and .Restriction properties of the ViewCtl should be changed (which should show the desired effects inside the view control in the Form) the problem i have run into is that the buttons/changes for the 4 folders that have the "ProjectID" field function properly, yet the 2 that have the "info" field throw an error as soon as the .Restriction is being set. i have double checked and the "info" property is defined both as a field on the form and as a userdefined folder field. furthermore the code used to change the fields is identical for all the Subroutines. the code that i'm using to change the field properties: ' inside Private Sub ________Click(Index As Integer) ' temp is a String variable set to the path of the folder the OVC is supposed to work with at the time ' strProjectIDNum is a String variable set to the Project ID number to be used as a filter frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).DeferUpdate = True frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).Folder = temp frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).DeferUpdate = False frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).Restriction = _ "[ProjectID] = """ & strProjectIDNum & """" ? why am i not using a "With" / "End With" statement block? it broke the code, last i tried. after i removed it some errors disappeared. ? why am i including the (frmProjDialog.ovcResults.UBound) ? because apparently there is an array defined within the ViewCtl and the one and only item in it is @ pos 6. to make sure i get it (in case that value changes) i access it at UBound. my questions. - is there anything about the viewctl that i have missed (initializationwise etc.) - am i using (referencing & setting) the properties correctly - any ideas on why the same code for the same type of thing (changing the value of a user defined property) will work for one but not the other i could really use some help on this and would appreciate any ideas. any further questions & clarifications i can provide, just ask. -cm |
#2
|
|||
|
|||
![]()
I believe your issue is that the custom Info field you describe is using the
Keywords data type, and this field may contain multiple values. Here's an excerpt from the Restrict method in Outlok VBA Help on Keywords fields: The Categories field is of type keywords, which is designed to hold multiple values. When accessing it programmatically, the Categories field behaves like a Text field, and the string must match exactly. Values in the text string are separated by a comma and a space. This typically means that you cannot use the Find and Restrict methods on a keywords field if it contains more than one value. For example, if you have one contact in the Business category and one contact in the Business and Social categories, you cannot easily use the Find and Restrict methods to retrieve all items that are in the Business category. Instead, you can loop through all contacts in the folder and use the Instr function to test whether the string "Business" is contained within the entire keywords field. Note A possible exception is if you limit the Categories field to two, or a low number of values. Then you can use the Find and Restrict methods with the OR logical operator to retrieve all Business contacts. For example (in pseudocode): "Business" OR "Business, Personal" OR "Personal, Business." Category strings are not case sensitive. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "codemonkey_147" wrote: greetings. current state of the union: userdefined fields have been added to custom Outlook forms and are being accessed and maintained by way of a dll with those forms Project information (such as Project ID number, Project Name, etc) can be associated with a particular Outlook item. in most items the item ![]() individual piece of info has a userdefined field in the form and published in the folder, except for the Contacts , where the association is n:n .in ordert to accomodate that a different field was created that stores the project information in a structured , delimited format and updates it according to user input. in oder to take advantage of this information i created a VB form and added an Outlook ViewCtl item to it. the idea was that the user can pick a certain Project beforehand and use buttons on the form to switch between folders which would only show the contents that applied to the previously defined project. the criteria by which would be decided what items would be shown was the ProjectID and the folder which were to be applied to the ViewCtl were known (ie. always the same folders). 4 of the 6 folders have the "ProjectID" field, the other 2 have the "info" field that contains the delimited string (which can contain 1 or more instances of a ProjectID) upon selection of a button the .Folder and .Restriction properties of the ViewCtl should be changed (which should show the desired effects inside the view control in the Form) the problem i have run into is that the buttons/changes for the 4 folders that have the "ProjectID" field function properly, yet the 2 that have the "info" field throw an error as soon as the .Restriction is being set. i have double checked and the "info" property is defined both as a field on the form and as a userdefined folder field. furthermore the code used to change the fields is identical for all the Subroutines. the code that i'm using to change the field properties: ' inside Private Sub ________Click(Index As Integer) ' temp is a String variable set to the path of the folder the OVC is supposed to work with at the time ' strProjectIDNum is a String variable set to the Project ID number to be used as a filter frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).DeferUpdate = True frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).Folder = temp frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).DeferUpdate = False frmProjDialog.ovcResults.Item(frmProjDialog.ovcRes ults.UBound).Restriction = _ "[ProjectID] = """ & strProjectIDNum & """" ? why am i not using a "With" / "End With" statement block? it broke the code, last i tried. after i removed it some errors disappeared. ? why am i including the (frmProjDialog.ovcResults.UBound) ? because apparently there is an array defined within the ViewCtl and the one and only item in it is @ pos 6. to make sure i get it (in case that value changes) i access it at UBound. my questions. - is there anything about the viewctl that i have missed (initializationwise etc.) - am i using (referencing & setting) the properties correctly - any ideas on why the same code for the same type of thing (changing the value of a user defined property) will work for one but not the other i could really use some help on this and would appreciate any ideas. any further questions & clarifications i can provide, just ask. -cm |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems with OVC .Restriction in a VB form used in an Outlook dll | codemonkey_147 | Outlook and VBA | 1 | February 8th 07 04:52 PM |
problems with OVC .Restriction in a VB form used in an Outlook dll | codemonkey_147 | Outlook and VBA | 0 | February 7th 07 06:55 PM |
MAPI32.dll problems | JimB | Outlook - Installation | 16 | December 28th 06 09:37 PM |
question how to get the outlook advanced find dialog and QueryRestriction restriction | roger | Add-ins for Outlook | 3 | November 27th 06 04:03 PM |
More Problems After mapi32.dll Fix - Cannot Open Outlook | Jimmy_Cullen | Outlook - Installation | 0 | June 2nd 06 03:13 PM |