A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

TO field



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 10th 09, 09:57 PM posted to microsoft.public.outlook.program_forms
Wanda
external usenet poster
 
Posts: 29
Default TO field

I have created a custom form. I have a drop down menu to be able to select
a province. Is there a way when a certain province is selected that it put
a certain address in the TO field on the form? When I put the code in and
we try to send the form, it comes saying "There must be a least one name or
distribution list in the To, CC or BCC box". If the form has something in
one of the fields (TO, CC or BCC) and then with the code, it will add the
code I put in ... but originally, I don't want anything in the name fields.
Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
Thank you.
Wanda
Ads
  #2  
Old August 10th 09, 10:08 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default TO field

See http://outlookcode.com/article.aspx?ID=38 for information on the events
you can use to change the To field when the user selects from your combo
box. The details depend on whether the combo box is bound to an Outlook
property and, of so, which one.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Wanda" wrote in message
...
I have created a custom form. I have a drop down menu to be able to
select
a province. Is there a way when a certain province is selected that it
put
a certain address in the TO field on the form? When I put the code in
and
we try to send the form, it comes saying "There must be a least one name
or
distribution list in the To, CC or BCC box". If the form has something
in
one of the fields (TO, CC or BCC) and then with the code, it will add the
code I put in ... but originally, I don't want anything in the name
fields.
Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
Thank you.
Wanda



  #3  
Old August 11th 09, 12:01 AM posted to microsoft.public.outlook.program_forms
Wanda
external usenet poster
 
Posts: 29
Default TO field

Hi Sue:
This works good to bring up a message. My code was:
***********
Sub cmdTest_Click()
Set objTab1 = Item.GetInspector.ModifiedFormPages("General")
Set objControls = objTab1.Controls("cmbProv")
IF objTab1.Controls("cmbProv")= "Saskatchewan" THEN
msgBox "Hi"
End If
End Sub
***************
When I change msgBox "hi" to:
..TO = "moyerw"

a message comes up saying "Invalid or unqualified reference". Can I put
the address in the TO (recipient) field this way?
Thank you.
Wanda

"Sue Mosher [MVP]" wrote:

See http://outlookcode.com/article.aspx?ID=38 for information on the events
you can use to change the To field when the user selects from your combo
box. The details depend on whether the combo box is bound to an Outlook
property and, of so, which one.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Wanda" wrote in message
...
I have created a custom form. I have a drop down menu to be able to
select
a province. Is there a way when a certain province is selected that it
put
a certain address in the TO field on the form? When I put the code in
and
we try to send the form, it comes saying "There must be a least one name
or
distribution list in the To, CC or BCC box". If the form has something
in
one of the fields (TO, CC or BCC) and then with the code, it will add the
code I put in ... but originally, I don't want anything in the name
fields.
Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
Thank you.
Wanda




  #4  
Old August 11th 09, 12:21 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default TO field

The error message means what it says. You have a ".To" expression outside a
With ... End With block. Therefore, Outlook has no idea what object's To
property your code refers to. Use either:

With Item
.To = "moyerw"
End With

or

Item.To = "moyerw"

Some suggestions:

-- If a control is bound to an Outlook field/property, refer to the
field value not the control value in your code; see
http://www.outlookcode.com/article.aspx?ID=38.

-- Once you have the value, use a Select Case ... End Select block to
evaluate it and perform other actions, not a series of If ... End If
statements.

-- When setting the value of To, use the full email address or an alias
that is uniquely resolvable to an address.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Wanda" wrote in message
...
Hi Sue:
This works good to bring up a message. My code was:
***********
Sub cmdTest_Click()
Set objTab1 = Item.GetInspector.ModifiedFormPages("General")
Set objControls = objTab1.Controls("cmbProv")
IF objTab1.Controls("cmbProv")= "Saskatchewan" THEN
msgBox "Hi"
End If
End Sub
***************
When I change msgBox "hi" to:
.TO = "moyerw"

a message comes up saying "Invalid or unqualified reference". Can I put
the address in the TO (recipient) field this way?
Thank you.
Wanda

"Sue Mosher [MVP]" wrote:

See http://outlookcode.com/article.aspx?ID=38 for information on the
events
you can use to change the To field when the user selects from your combo
box. The details depend on whether the combo box is bound to an Outlook
property and, of so, which one.

"Wanda" wrote in message
...
I have created a custom form. I have a drop down menu to be able to
select
a province. Is there a way when a certain province is selected that
it
put
a certain address in the TO field on the form? When I put the code in
and
we try to send the form, it comes saying "There must be a least one
name
or
distribution list in the To, CC or BCC box". If the form has
something
in
one of the fields (TO, CC or BCC) and then with the code, it will add
the
code I put in ... but originally, I don't want anything in the name
fields.
Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
Thank you.
Wanda



  #5  
Old August 11th 09, 03:55 PM posted to microsoft.public.outlook.program_forms
Wanda
external usenet poster
 
Posts: 29
Default TO field

Thank you very much Sue! It works like a charm. This helped a great deal.
You helped out in other parts of the custom form also, which was an asset.
Again, thank you very much.
Wanda

"Sue Mosher [MVP]" wrote:

The error message means what it says. You have a ".To" expression outside a
With ... End With block. Therefore, Outlook has no idea what object's To
property your code refers to. Use either:

With Item
.To = "moyerw"
End With

or

Item.To = "moyerw"

Some suggestions:

-- If a control is bound to an Outlook field/property, refer to the
field value not the control value in your code; see
http://www.outlookcode.com/article.aspx?ID=38.

-- Once you have the value, use a Select Case ... End Select block to
evaluate it and perform other actions, not a series of If ... End If
statements.

-- When setting the value of To, use the full email address or an alias
that is uniquely resolvable to an address.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Wanda" wrote in message
...
Hi Sue:
This works good to bring up a message. My code was:
***********
Sub cmdTest_Click()
Set objTab1 = Item.GetInspector.ModifiedFormPages("General")
Set objControls = objTab1.Controls("cmbProv")
IF objTab1.Controls("cmbProv")= "Saskatchewan" THEN
msgBox "Hi"
End If
End Sub
***************
When I change msgBox "hi" to:
.TO = "moyerw"

a message comes up saying "Invalid or unqualified reference". Can I put
the address in the TO (recipient) field this way?
Thank you.
Wanda

"Sue Mosher [MVP]" wrote:

See http://outlookcode.com/article.aspx?ID=38 for information on the
events
you can use to change the To field when the user selects from your combo
box. The details depend on whether the combo box is bound to an Outlook
property and, of so, which one.

"Wanda" wrote in message
...
I have created a custom form. I have a drop down menu to be able to
select
a province. Is there a way when a certain province is selected that
it
put
a certain address in the TO field on the form? When I put the code in
and
we try to send the form, it comes saying "There must be a least one
name
or
distribution list in the To, CC or BCC box". If the form has
something
in
one of the fields (TO, CC or BCC) and then with the code, it will add
the
code I put in ... but originally, I don't want anything in the name
fields.
Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
Thank you.
Wanda




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
date formulas / mathematics, setting a field one hour past another field value cmonroe21 via OfficeKB.com Outlook - Using Forms 1 March 19th 09 12:17 AM
Copying Data form user field to custom field [email protected] Outlook - Using Contacts 1 September 4th 06 07:32 PM
move phone numbers from company field to business field Tyson Outlook and VBA 3 June 9th 06 06:38 PM
Adding Follow Up field to Field Chooser Programatically. c Outlook and VBA 3 February 25th 06 03:10 PM
Populate Company field from Contact field in custom task form Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 08:37 PM


All times are GMT +1. The time now is 07:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.