Applying a changed form to existing contacts

G

Guest

(Thanks to Sue Mosher) I've successfully changed my Outlook Contacts form.
Now I would like to apply this changed form to all existing Contacts in my
Contacts folder. How can I do this?
 
S

Sue Mosher [MVP-Outlook]

Change the MessageClass property's value so that it points to your published form's class. Scripts and other tool links at http://www.outlookcode.com/d/newdefaultform.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

This is wonderful - it works! I've set my cutomized form as default and thia
works for the existing contacts too. But...

As I open an existing contact (with the new form) and I activate the tab
with the customized textbox (see post: Combining fields and new line), it
shows #ERROR and I have to change something in the form (anything), to get it
to recalculate and display the correct contents. After I save the form, the
correct contents remain.

Can I alter the field or form to avoid this?
 
S

Sue Mosher [MVP-Outlook]

I'm sure you can, but only you know the details of exactly what formula might be causing the problem. Please don't send us trying to track down another discussion thread. Post the details in this thread.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Excuse me...

I have a textfield with a formula like this in it:

[Company] & Chr(13) & Chr(10) & [Full Name] & Chr(13) & Chr(10) &
[Business Address]

The property of the field is set to "Auto calculate field" (or whatever this
is in English - I have a Dutch version) but it only recalculates after a
change to any field.
 
S

Sue Mosher [MVP-Outlook]

Since you have a Dutch version, did you pick the fields from the Field List to make sure you got the right names? (They may be localized for formula purposes.)

An ERROR# on first displaying the item could mean that one of the fields in the formula has never held any value.

The alternative to using a formula is to use a published form with code behind it to set the value of a text field. See http://www.outlookcode.com/d/propsyntax.htm for syntax basics.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


BartH_NL said:
I have a textfield with a formula like this in it:

[Company] & Chr(13) & Chr(10) & [Full Name] & Chr(13) & Chr(10) &
[Business Address]

The property of the field is set to "Auto calculate field" (or whatever this
is in English - I have a Dutch version) but it only recalculates after a
change to any field.
 
G

Guest

Of cource (I'm not that blond ;-)) I picked the translated fields from the
Field List.
[Bedrijf] & Chr(13) & Chr(10) & "t.a.v. " & [Volledige naam] & Chr(13) &
Chr(10) & [Adres voor adressenlijst]

As I mentioned before, the formula works fine for a new contact. The fields
of the original form are exactly the same as on the new form, as the new form
is built from the old form.
I've slept on it one night and I understand that as the field is added and
so the formula is applied AFTER the form had been saved and calculated, the
fields remain empty. As soon as I perform an action on the form, the fields
are recalculated and the fields are filled in properly.

When I save, close and reopen the contact form - the values are still there,
but when I reopen Outlook, they are gone again and the field shows #FOUT
(#ERROR) again.

A new contact made with this form remains correct.

I hope this discussion isn't getting too boring as this same problem might
occure whenever you apply a changed form with a new calculated field to
exsiting Contacts folder members, so I think this matter deserves a solution.

I too experimented with the option to script the data collection. I tried
the following code (which doesn't work by the way):

Public WithEvents objPage As Outlook.Inspector

Public Sub Initialize_handler()
Set objPage = ModifiedFormPages("Adres")
End Sub

Private Sub objPage_Activate()

Set objControl = objPage.Controls("TextBox1")
objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]

End Sub


Instead, I made a workaround with a cmdButton and this code:

sub commandbutton1_click()
Set objPage = Item.GetInspector.ModifiedFormPages("Adres")
Set objControl = objPage.Controls("TextBox1")

objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]
end sub

This works fine, but doesn't still solves the previous problem.

*******************************

Sue Mosher said:
Since you have a Dutch version, did you pick the fields from the Field List to make sure you got the right names? (They may be localized for formula purposes.)

An ERROR# on first displaying the item could mean that one of the fields in the formula has never held any value.

The alternative to using a formula is to use a published form with code behind it to set the value of a text field. See http://www.outlookcode.com/d/propsyntax.htm for syntax basics.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


BartH_NL said:
I have a textfield with a formula like this in it:

[Company] & Chr(13) & Chr(10) & [Full Name] & Chr(13) & Chr(10) &
[Business Address]

The property of the field is set to "Auto calculate field" (or whatever this
is in English - I have a Dutch version) but it only recalculates after a
change to any field.
As I open an existing contact (with the new form) and I activate the tab
with the customized textbox (see post: Combining fields and new line), it
shows #ERROR and I have to change something in the form (anything), to get it
to recalculate and display the correct contents. After I save the form, the
correct contents remain.

Can I alter the field or form to avoid this?
 
S

Sue Mosher [MVP-Outlook]

The syntax for referring to a field in code is not the same as for a formula. The event to use is PropertyChange. See http://www.outlookcode.com/d/propsyntax.htm

I have no explanation for the problem with the formula field, though.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


BartH_NL said:
Of cource (I'm not that blond ;-)) I picked the translated fields from the
Field List.
[Bedrijf] & Chr(13) & Chr(10) & "t.a.v. " & [Volledige naam] & Chr(13) &
Chr(10) & [Adres voor adressenlijst]

As I mentioned before, the formula works fine for a new contact. The fields
of the original form are exactly the same as on the new form, as the new form
is built from the old form.
I've slept on it one night and I understand that as the field is added and
so the formula is applied AFTER the form had been saved and calculated, the
fields remain empty. As soon as I perform an action on the form, the fields
are recalculated and the fields are filled in properly.

When I save, close and reopen the contact form - the values are still there,
but when I reopen Outlook, they are gone again and the field shows #FOUT
(#ERROR) again.

A new contact made with this form remains correct.

I hope this discussion isn't getting too boring as this same problem might
occure whenever you apply a changed form with a new calculated field to
exsiting Contacts folder members, so I think this matter deserves a solution.

I too experimented with the option to script the data collection. I tried
the following code (which doesn't work by the way):

Public WithEvents objPage As Outlook.Inspector

Public Sub Initialize_handler()
Set objPage = ModifiedFormPages("Adres")
End Sub

Private Sub objPage_Activate()

Set objControl = objPage.Controls("TextBox1")
objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]

End Sub


Instead, I made a workaround with a cmdButton and this code:

sub commandbutton1_click()
Set objPage = Item.GetInspector.ModifiedFormPages("Adres")
Set objControl = objPage.Controls("TextBox1")

objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]
end sub

This works fine, but doesn't still solves the previous problem.

*******************************

Sue Mosher said:
Since you have a Dutch version, did you pick the fields from the Field List to make sure you got the right names? (They may be localized for formula purposes.)

An ERROR# on first displaying the item could mean that one of the fields in the formula has never held any value.

The alternative to using a formula is to use a published form with code behind it to set the value of a text field. See http://www.outlookcode.com/d/propsyntax.htm for syntax basics.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


BartH_NL said:
I have a textfield with a formula like this in it:

[Company] & Chr(13) & Chr(10) & [Full Name] & Chr(13) & Chr(10) &
[Business Address]

The property of the field is set to "Auto calculate field" (or whatever this
is in English - I have a Dutch version) but it only recalculates after a
change to any field.

As I open an existing contact (with the new form) and I activate the tab
with the customized textbox (see post: Combining fields and new line), it
shows #ERROR and I have to change something in the form (anything), to get it
to recalculate and display the correct contents. After I save the form, the
correct contents remain.

Can I alter the field or form to avoid this?
 
G

Guest

Well Sue - I got it...

The solution is to use the following code:

Sub Item_Open()
' address the proper form
Set objPage = Item.GetInspector.ModifiedFormPages("Adres")
' address the proper object
Set objControl = objPage.Controls("TextBox1")
' state the object's value
objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]
End Sub

On the form TextBox1 is an simple empty unbound object (set to multi-line).

I never though of using Item_Open() as I kept looking for the form's
Initialize methode...


Sue Mosher said:
The syntax for referring toItem_Open()
a field in code is not the same as for a formula. The event to use is
PropertyChange. See http://www.outlookcode.com/d/propsyntax.htm
I have no explanation for the problem with the formula field, though.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


BartH_NL said:
Of cource (I'm not that blond ;-)) I picked the translated fields from the
Field List.
[Bedrijf] & Chr(13) & Chr(10) & "t.a.v. " & [Volledige naam] & Chr(13) &
Chr(10) & [Adres voor adressenlijst]

As I mentioned before, the formula works fine for a new contact. The fields
of the original form are exactly the same as on the new form, as the new form
is built from the old form.
I've slept on it one night and I understand that as the field is added and
so the formula is applied AFTER the form had been saved and calculated, the
fields remain empty. As soon as I perform an action on the form, the fields
are recalculated and the fields are filled in properly.

When I save, close and reopen the contact form - the values are still there,
but when I reopen Outlook, they are gone again and the field shows #FOUT
(#ERROR) again.

A new contact made with this form remains correct.

I hope this discussion isn't getting too boring as this same problem might
occure whenever you apply a changed form with a new calculated field to
exsiting Contacts folder members, so I think this matter deserves a solution.

I too experimented with the option to script the data collection. I tried
the following code (which doesn't work by the way):

Public WithEvents objPage As Outlook.Inspector

Public Sub Initialize_handler()
Set objPage = ModifiedFormPages("Adres")
End Sub

Private Sub objPage_Activate()

Set objControl = objPage.Controls("TextBox1")
objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]

End Sub


Instead, I made a workaround with a cmdButton and this code:

sub commandbutton1_click()
Set objPage = Item.GetInspector.ModifiedFormPages("Adres")
Set objControl = objPage.Controls("TextBox1")

objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]
end sub

This works fine, but doesn't still solves the previous problem.

*******************************

Sue Mosher said:
Since you have a Dutch version, did you pick the fields from the Field List to make sure you got the right names? (They may be localized for formula purposes.)

An ERROR# on first displaying the item could mean that one of the fields in the formula has never held any value.

The alternative to using a formula is to use a published form with code behind it to set the value of a text field. See http://www.outlookcode.com/d/propsyntax.htm for syntax basics.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



I have a textfield with a formula like this in it:

[Company] & Chr(13) & Chr(10) & [Full Name] & Chr(13) & Chr(10) &
[Business Address]

The property of the field is set to "Auto calculate field" (or whatever this
is in English - I have a Dutch version) but it only recalculates after a
change to any field.

As I open an existing contact (with the new form) and I activate the tab
with the customized textbox (see post: Combining fields and new line), it
shows #ERROR and I have to change something in the form (anything), to get it
to recalculate and display the correct contents. After I save the form, the
correct contents remain.

Can I alter the field or form to avoid this?
 
G

Guest

Eureka!!!

The solution was the simplest of all... I kept looking for the initialize
event of the form, but I needed the Item_Open()

Sub Item_Open()
Set objPage = Item.GetInspector.ModifiedFormPages("Adres")
Set objControl = objPage.Controls("TextBox1")
objControl.Value = _
[CompanyName] & Chr(13) & Chr(10) & _
"t.a.v. " & [FullName] & Chr(13) & Chr(10) & _
[MailingAddress]
End Sub



Sue Mosher said:
The syntax for referring to a field in code is not the same as for a formula. The event to use is PropertyChange. See http://www.outlookcode.com/d/propsyntax.htm

I have no explanation for the problem with the formula field, though.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


BartH_NL said:
Of cource (I'm not that blond ;-)) I picked the translated fields from the
Field List.
[Bedrijf] & Chr(13) & Chr(10) & "t.a.v. " & [Volledige naam] & Chr(13) &
Chr(10) & [Adres voor adressenlijst]

As I mentioned before, the formula works fine for a new contact. The fields
of the original form are exactly the same as on the new form, as the new form
is built from the old form.
I've slept on it one night and I understand that as the field is added and
so the formula is applied AFTER the form had been saved and calculated, the
fields remain empty. As soon as I perform an action on the form, the fields
are recalculated and the fields are filled in properly.

When I save, close and reopen the contact form - the values are still there,
but when I reopen Outlook, they are gone again and the field shows #FOUT
(#ERROR) again.

A new contact made with this form remains correct.

I hope this discussion isn't getting too boring as this same problem might
occure whenever you apply a changed form with a new calculated field to
exsiting Contacts folder members, so I think this matter deserves a solution.

I too experimented with the option to script the data collection. I tried
the following code (which doesn't work by the way):

Public WithEvents objPage As Outlook.Inspector

Public Sub Initialize_handler()
Set objPage = ModifiedFormPages("Adres")
End Sub

Private Sub objPage_Activate()

Set objControl = objPage.Controls("TextBox1")
objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]

End Sub


Instead, I made a workaround with a cmdButton and this code:

sub commandbutton1_click()
Set objPage = Item.GetInspector.ModifiedFormPages("Adres")
Set objControl = objPage.Controls("TextBox1")

objControl.Value = [CompanyName] & Chr(13) & Chr(10) & "t.a.v. " &
[FullName] & Chr(13) & Chr(10) & [MailingAddress]
end sub

This works fine, but doesn't still solves the previous problem.

*******************************

Sue Mosher said:
Since you have a Dutch version, did you pick the fields from the Field List to make sure you got the right names? (They may be localized for formula purposes.)

An ERROR# on first displaying the item could mean that one of the fields in the formula has never held any value.

The alternative to using a formula is to use a published form with code behind it to set the value of a text field. See http://www.outlookcode.com/d/propsyntax.htm for syntax basics.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



I have a textfield with a formula like this in it:

[Company] & Chr(13) & Chr(10) & [Full Name] & Chr(13) & Chr(10) &
[Business Address]

The property of the field is set to "Auto calculate field" (or whatever this
is in English - I have a Dutch version) but it only recalculates after a
change to any field.

As I open an existing contact (with the new form) and I activate the tab
with the customized textbox (see post: Combining fields and new line), it
shows #ERROR and I have to change something in the form (anything), to get it
to recalculate and display the correct contents. After I save the form, the
correct contents remain.

Can I alter the field or form to avoid this?
 

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