Custom Contact Form how to update when loaded.

Status
Not open for further replies.

Roland Askew

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
I have created a custom contact form which calculated the contact age based on their date of birth. The age is stored in a user defined field and I use the normal date of birth field. All this works perfectly when creating the contact the problem is when you open the contact later the age field does not to their current age. If a year later you open the contact then their age should be one year greater however this does not happen until one of the fields is changed and the property change event is run. Then it calculates the age correctly.

Is there anyway to run this event when the form is loaded or how would I run the repaint if that would work.

I currently have a poor work around by using the form opening event and changing a field using vba and then changing it back.

Thanks for any help anyone can give and if needed I am using Outlook 2016.

Roland
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Are you using code or a custom field with a formula? If you use code, you need to use item_open, not on property change. With custom field, you need to set the field to update automatically.

To calculate the age of an Outlook contact has a sample that updates.
 

Roland Askew

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Thank you for the two replies.

I am using a custom field with a formula and I have the field to update automatically. The problem is that it does not automatically update when the form is loaded. Is the update automatically suppose to run when the form is opened? However, as soon as I change anything on the contact then the field does update and the correct age is shown. I assume that the property change event does this.

Is there away to run the property change event when opening the form? As a work around I have in the opening form event vbscript which changes one of the fields and then changes it back and that seems to set the update event off.

Otherwise, I think the alternative is to use code for to check the field and run this in both the open event and the property change event.

Any suggestions on how better to do this would be much appreciated.
Thanks
Roland
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I don't know if its a problem with newer versions or something else (and i can't find my really old form to see if it works in 2016 or refresh my memory to see if the age updated automatically there)... but my version of your method works - i have a hidden text box set to have 'now' as the value and use this the item_open script to clear the field then save it.
Code:
Sub Item_Open()
  Set FormPage = Item.GetInspector.ModifiedFormPages("Contact Age")
  Set TextBox4 = FormPage.Controls("TextBox4")
  TextBox4.value = "None"
Item.save
End Sub
fields.png




(if you use a field in the view, it should update when you leave the folder and come back. )
 

Roland Askew

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Hi Diane
Thank you for taking the time to help me with this due to ease I have gone with updating the Opening event on the form with code that checks the field as follows

Function Item_Open()
If Item.Birthday = #1/1/4501# Then
Item.UserProperties.item("Age Client") = 0​
Else
If Date() >= DateSerial(Year(Date()),Month(Item.Birthday),Day(Item.Birthday)) Then
Item.UserProperties.item("Age Client")=Year( Date()) - Year(Item.Birthday)​
Else
Item.UserProperties.item("Age Client")=Year( Date()) - Year(Item.Birthday) - 1​
End If​
End if
Item.Save
End Function

This seems to work ok and has the advantage of not needing to create new text field.

Thanks again yours and Michael knowledge and help is invaluable as always.
Roland
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
As long as it works. :) In my case, i used the longer age function and didn't want to convert the long formula to the script - forcing an update was easier.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
O Create a custom contact form - questions before messing things up... Outlook VBA and Custom Forms 4
M vCard does not have user-defined fields from my custom contact form (365) Using Outlook 1
Victor_50 Outlook 2013 Custom Contact Form starts with "E-mail 2" Outlook VBA and Custom Forms 2
Randy Redekopp How To Merge Contact Info to Email Custom Form Template Using Outlook 2
G Copy Contact field to Appointment Custom Form Field Outlook VBA and Custom Forms 2
G Adding a contact to Outlook with a custom form using Access VBA Outlook VBA and Custom Forms 1
Z how to make OL (2007) to use custom contact form when importing / opening .VCF? Using Outlook 1
oliv- Why custom form is different from original ipm.contact ? Outlook VBA and Custom Forms 4
Q Custom Contact Form - applied to existing contacts Outlook VBA and Custom Forms 5
F Custom contact form icon issue Using Outlook 1
C Outlook Custom Contact Form Attach Files in new notes fields Outlook VBA and Custom Forms 3
makinmyway Can I add a Map It Button to Custom Contact Form? How? Outlook VBA and Custom Forms 6
Z outlook 2007 - opening a contact from the search results doesn't use the custom form Using Outlook 10
T Cannot view main tab of contact custom form BCM (Business Contact Manager) 0
J How to create a user defined dropdown list field for a custom contact form Using Outlook 3
B Contact changes from Personal to Shared when opening custom form Using Outlook 0
H Custom Contact form not working in Outlook 2003 Using Outlook 3
H Custom Outlook Contact form Using Outlook 1
P OL2010 - custom form contact picture Using Outlook 0
C Custom Contact form - erase default value Using Outlook 0
M Custom Contact form queries (date control & contact/calender linking) Using Outlook 1
J Sharing Contact w/ a custom form Using Outlook 3
H How can you add a URL field in a Outlook Custom Contact form? Using Outlook 6
P migration issue from OL2003 to OL2010 with custom contact form Using Outlook 7
C Contact Custom Form - Category View Using Outlook 3
G how to set contact custom form as default contact form? Using Outlook 7
A Custom contact form replaced with the default OL form for another user Outlook VBA and Custom Forms 1
A New Contact entry (custom form) get saved in a public folder and doesn't appear in Outolook Contacts Outlook VBA and Custom Forms 3
J Checkboxes in Contact Custom Form Outlook VBA and Custom Forms 1
N Custom Contact Form in Outlook 2003 Outlook VBA and Custom Forms 1
K Accessing contact's custom properties in a Outlook 2007 form region Outlook VBA and Custom Forms 1
S Custom Contact Form Outlook VBA and Custom Forms 1
Z Custom contact form Outlook VBA and Custom Forms 7
J Backup .OST - Custom Contact Forms, Defined Fields, Notes Using Outlook 1
P Creating custom contact forms Using Outlook 2
J How Can I Change Owner of Custom Contact? Using Outlook 1
J Controlling/Changing owner of a Custom Contact item Using Outlook 0
V Custom UI Runtime Error in Business Contact Manager for Outlook (2013) BCM (Business Contact Manager) 6
M Business Contact Manager 2010 - Running With Custom Mail Profile Using Outlook 2
T Custom Contact Forms and User Properties Outlook VBA and Custom Forms 2
Q More than one Notes section in custom contact forms Outlook VBA and Custom Forms 1
S Custom Field Cannot Be Displayed In Views Outlook VBA and Custom Forms 2
D Custom Search Folders not refreshing/updating automatically Using Outlook 0
F Validation on custom task form after task acceptance Outlook VBA and Custom Forms 1
K UDF with formula not showing on Calendar custom view. Outlook VBA and Custom Forms 0
S Create a clickable custom column field Outlook VBA and Custom Forms 0
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
G Other users can't see P.2 with custom fields in Form Outlook VBA and Custom Forms 0
S Reference Custom Fields with VBA Outlook VBA and Custom Forms 2

Similar threads

Top