cant overtype on custom form textbox

S

Sydney

Hi

I have an outlook form with a Contacts button to bring in the phone number
(BusinessTelephoneNumber ) from the selected contact into the txtPhoneNumber
Text Box.

This works ok but it doesnt allow me to have the choice of changing the
phone number brought into txtPHoneNumber. It keeps reverting to the
BusinessTelephoneNumber .

Now i sadly have no coding skills and grabbed the information i have from
the net and altered it my way:

Sub Item_PropertyChange(ByVal strName)

' Remember business phone number
Item.BillingInformation = objContactItem.BusinessTelephoneNumber 'puts
the No. in the txtPhoneNumber

' Set phone number
strPhoneNumber = objContactItem.BusinessTelephoneNumber 'holds it in string


' Remove phone number
'Item.BillingInformation = ""

'Item.GetInspector.ModifiedFormPages("Message").Controls("txtPhoneNumber").V
alue = ""

'test
msgbox strPhoneNumber

Any ideas?
 
S

Sue Mosher [MVP-Outlook]

Tell us more about txtPhoneNumber. Is it an unbound text box? Is it bound to an Outlook property? What is it that you're actually trying to accomplish with this control?

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

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

Sydney

No its not bound to an outlook property. The txtPhoneNumber text box
automatically populates the BusinessTelephoneNumber based on the contact
chosen, this is done via the vbscript. I would then like to give users the
option to overtype this number.

Hope this makes sense



Tell us more about txtPhoneNumber. Is it an unbound text box? Is it bound to
an Outlook property? What is it that you're actually trying to accomplish
with this control?

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

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

Sue Mosher [MVP-Outlook]

If your real goal is to populate the BusinessTelephoneNumber field, the easiest way to do that is to bind the txtPhoneNumber text box to that property.

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

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

Sydney

Thanks, that is alot easier.
I bound the txtPhoneNumber to the BillingInformation field (I couldnt see
BusinessTelephoneNumber in the list).

However I run into the same problem, once txtPhoneNumber is bound, the value
cannot be changed by the user. Is there a way I can do this ? Users would
like an option to change the phone number.

Many thanks


If your real goal is to populate the BusinessTelephoneNumber field, the
easiest way to do that is to bind the txtPhoneNumber text box to that
property.

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

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

Sue Mosher [MVP-Outlook]

You didn't set a formula on that field's control, did you? That's one of two ways to make a control read-only, the other being to check the read-only box directly.

The BusinessTelephoneNumber property is listed under Phone Number fields in the field chooser as Business Phone.

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

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

Hollis D. Paul

Thanks, that is alot easier.
I bound the txtPhoneNumber to the BillingInformation field (I couldnt see
BusinessTelephoneNumber in the list).
What is the MessageClass of your custom form?

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
S

Sydney

No, no code behind the field. I couldn't see the Business Phone as I was
designing a message, i found it when i opened a contact in design mode but
it wouldn't let me drag it to my message. (Im creating a telephone msg form)

I double checked and its not read only (atleast the tick is not on).

With VBSCRIPT, do you know how i can empty a variable? eg, i have strPhone
set to equal a number typed it and i would then like to empty that variable
to reuse.

I tried Set strPhone = Nothing

I just cant see another way of enabling this phone number to allow change ?

Thank you so much for the guidance.


You didn't set a formula on that field's control, did you? That's one of two
ways to make a control read-only, the other being to check the read-only box
directly.

The BusinessTelephoneNumber property is listed under Phone Number fields in
the field chooser as Business Phone.

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

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

Sydney

Hi

Im using IPM.Note ?
Could this be my problem?


Hollis D. Paul said:
Thanks, that is alot easier.
I bound the txtPhoneNumber to the BillingInformation field (I couldnt see
BusinessTelephoneNumber in the list).
What is the MessageClass of your custom form?

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
S

Sue Mosher [MVP-Outlook]

No, no code behind the field. I couldn't see the Business Phone as I was
designing a message, i found it when i opened a contact in design mode but
it wouldn't let me drag it to my message. (Im creating a telephone msg form)

Do you mean that you're trying to add a contact field to a message form? That generally won't work. Use a custom property instead.

However, custom message forms are usually a bad idea, too, unless they're destined for use only within your own organization where everyone uses Outlook.
With VBSCRIPT, do you know how i can empty a variable? eg, i have strPhone
set to equal a number typed it and i would then like to empty that variable
to reuse.

I tried Set strPhone = Nothing

You use Set <obj> = Nothing only with objects. If strPhone is a string variable, just set it to a blank string:

strPhone = ""

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

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

Hollis D. Paul

Im using IPM.Note ?
Could this be my problem?
Could be. The field you are talking about is a contact form field, and
probably can't be used on a message form.

Are you trying to mail this form to somebody? Or is the form just
being saved to a contacts folder? If the latter, then you probably
want to customize a IPM.Contact form, and just hid the tabs you really
don't want to see.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
S

Sydney

Tried everything and I dont think I should keep bothering you, so I am
throwing in the towel.

Thank you greatly to Sue and Paul for being so helpful.


Sue Mosher said:
No, no code behind the field. I couldn't see the Business Phone as I was
designing a message, i found it when i opened a contact in design mode but
it wouldn't let me drag it to my message. (Im creating a telephone msg
form)

Do you mean that you're trying to add a contact field to a message form?
That generally won't work. Use a custom property instead.

However, custom message forms are usually a bad idea, too, unless they're
destined for use only within your own organization where everyone uses
Outlook.
With VBSCRIPT, do you know how i can empty a variable? eg, i have strPhone
set to equal a number typed it and i would then like to empty that variable
to reuse.

I tried Set strPhone = Nothing

You use Set <obj> = Nothing only with objects. If strPhone is a string
variable, just set it to a blank string:

strPhone = ""

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

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

Sue Mosher [MVP-Outlook]

Tried everything including adding a custom field?

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

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

Sydney

By custom field you mean by dragging a text box for example? If so, yes i
have tried that. But i couldnt find the BusinessTelephoneNumber control
(From what Paul mentioned it must be because im using IPM.Note) I then
tried to use IPM.Contact to create my PhoneMessage Template but it always
asks me to save the it as a contact when i press the contact control.

So I went back to my IPM.Note.TelephoneMessage and used the vbscript to
populate the BusinessTelephoneNumber.

strPhoneNumber = objContactItem.BusinessTelephoneNumber
Item.GetInspector.ModifiedFormPages("Message").Controls("txtPhoneNumber").Value
= strPhoneNumber
Then Im back to square one, the above works but is unchangeable by the user.

As another test, I bound another custom textbox to the txtPhoneNumber field
(as above it loads the BusinessTelephoneNumber), same issue. As you said,
it marks as read only if it has code behind it? But thats the only way I
can populate it in my message template :(



Tried everything including adding a custom field?

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

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

Sue Mosher [MVP-Outlook]

I think we could use a "big picture" description of what you're trying to do. We still don't know why you're trying to work with a contact field on a message form.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

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

Sydney

This template will replace the paper telephone message pad.

Lets say someone takes a message for me to call you, they open the template,
click on the contact field, select Sue Mosher. Your name and phone number
are automatically populated in the template.


I think we could use a "big picture" description of what you're trying to
do. We still don't know why you're trying to work with a contact field on a
message form.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

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

Sue Mosher [MVP-Outlook]

That scenario cannot be accomplished just by dragging fields from the Field Chooser. It requires code behind the form. Do you have any yet? If not, the VBA sample at http://www.outlookcode.com/codedetail.aspx?id=566 will show you how to get contact information from a contact linked in another item. The example is for a task, but the technique of using the Links collection would apply just as well to a message.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

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

Sydney

Great Thanks :)

That scenario cannot be accomplished just by dragging fields from the Field
Chooser. It requires code behind the form. Do you have any yet? If not, the
VBA sample at http://www.outlookcode.com/codedetail.aspx?id=566 will show
you how to get contact information from a contact linked in another item.
The example is for a task, but the technique of using the Links collection
would apply just as well to a message.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

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

Sydney

Great Thanks :)

That scenario cannot be accomplished just by dragging fields from the Field
Chooser. It requires code behind the form. Do you have any yet? If not, the
VBA sample at http://www.outlookcode.com/codedetail.aspx?id=566 will show
you how to get contact information from a contact linked in another item.
The example is for a task, but the technique of using the Links collection
would apply just as well to a message.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

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

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