Button working in Design but not in saved form

B

BradC

Hi,

A form I have designed uses a button to send it, the button checks fields
are data and selects the To field contents depending on dropdown boxes. The
button works if I am in design view and go Run this form but if I open a save
version the button does nothing!

Any idea what is going on?

Thanks,
Brad
 
S

Sue Mosher [MVP-Outlook]

If the form runs code when you use Run This Form in design mode, but doesn't run code after you have sent or saved an item using the published form, you probably have done something to "one-off" the form. Outlook 2003, Outlook 2002, Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update will not run code on one-off forms; see http://www.outlookcode.com/d/secforms.htm for more information on this issue.

To ensure that a form does not one-off:

-- Make sure the "Send form definition with item" box on the (Properties) tab of the form is *not* checked. [1]

-- For in-house corporate use with Exchange Server, publish the form to the Organization Forms library or a public folder's forms library, as appropriate for your application.

-- For collaboration via the Internet, publish your form to your Personal Forms library. Save it as an .oft file and send it to other people who need to use it with instructions to publish it with the same form name that you used.

-- Set the Forward action on a custom form's (Actions) page to the published custom form.

Many other things can cause one-off forms. If the above steps don't work on a new item created with your form, see http://www.outlookcode.com/d/formpub.htm#oneoff for other possible causes.

[1] Whenever you publish a message form, Outlook will suggest that you may want to check the "Send form definition with item" box to ensure that the recipient will have the form, especially if you're sending to someone via the Internet. In the current Outlook security environment, this suggestion is obsolete. Ignore it unless your form has no code behind it.
 
B

BradC

Thanks. Now understand why its not working.

Do you mind looking at my code to see if you can find anything that would
"one-off" it? Thought is would be Item.Send or Item.To but removing these
did not allow it to work.

Code...

Dim strIndent

Sub PrintIDs(objCB)
For Each objCBControl In objCB.Controls
Item.Body = Item.Body & strIndent & objCBControl.ID & ": " &
objCBControl.Caption & vbCrLf
If objCBControl.Type = 10 Then
strIndent = strIndent & vbTab
PrintIDs objCBControl.CommandBar
If Len(strIndent) > 0 Then strIndent = Left(strIndent,
Len(strIndent) - 1)
End If
Next
End Sub


Sub Send_Click()

'MISSING FIELDS

if Item.UserProperties.Find("Staff Title").Value = "" then
Msgbox "Please enter the CSC's title",,"Missing Data"
Exit Sub
End if

if Item.UserProperties.Find("Staff name").Value = "" then
Msgbox "Please enter the Staff members name",,"Missing Data"
Exit Sub
End if

if Item.UserProperties.Find("Staff number").Value = "" then
Msgbox "Please enter the Staff number",,"Missing Data"
Exit Sub
End if

if Item.UserProperties.Find("Windows login").Value = "" then
Msgbox "Please enter the Windows Login of the staff member",,"Missing Data"
Exit Sub
End if

If Item.UserProperties.Find("Brand Required").Value = "" then
MsgBox "Select the Brand"
Exit Sub
End If

If Item.UserProperties.Find("CSCSite").Value = "" then
MsgBox "Select the Site"
Exit Sub
End If

if Item.UserProperties.Find("INeed").Value = "" OR
Item.UserProperties.Find("INeed").Value = "Please select from the drop box"
then
Msgbox "Please enter what the request is for",,"Missing Data"
Exit Sub
End if

'POPULATE THE TO FIELD

If Item.UserProperties.Find("Brand required").Value = "KNZ" then emailto =
"(e-mail address removed)"

If Item.UserProperties.Find("Brand required").Value = "NBZ" AND
Item.UserProperties.Find("NBZModelSite").Value = "Wellington" then emailto =
"(e-mail address removed)"

If Item.UserProperties.Find("Brand required").Value = "NBZ" AND
Item.UserProperties.Find("NBZModelSite").Value = "Auckland" then emailto =
"(e-mail address removed)"

If Item.UserProperties.Find("Brand required").Value = "NBZ" AND
Item.UserProperties.Find("NBZModelSite").Value = "Both" then emailto = ""

If Item.UserProperties.Find("Brand required").Value = "Both" AND
Item.UserProperties.Find("NBZModelSite").Value = "Wellington" then emailto =
"(e-mail address removed); (e-mail address removed)"

If Item.UserProperties.Find("Brand required").Value = "Both" AND
Item.UserProperties.Find("NBZModelSite").Value = "Auckland" then emailto =
"(e-mail address removed); (e-mail address removed)"

If Item.UserProperties.Find("Brand required").Value = "Both" AND
Item.UserProperties.Find("NBZModelSite").Value = "Both" then emailto =
"(e-mail address removed); "

Item.To = emailto

Item.Send

End Sub
 
S

Sue Mosher [MVP-Outlook]

I see nothing in your code that would one-off the form. Did you look into all the issues on my earlier list, especially the first 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


BradC said:
Thanks. Now understand why its not working.

Do you mind looking at my code to see if you can find anything that would
"one-off" it? Thought is would be Item.Send or Item.To but removing these
did not allow it to work.

Code...

If the form runs code when you use Run This Form in design mode, but doesn't run code after you have sent or saved an item using the published form, you probably have done something to "one-off" the form. Outlook 2003, Outlook 2002, Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update will not run code on one-off forms; see http://www.outlookcode.com/d/secforms.htm for more information on this issue.

To ensure that a form does not one-off:

-- Make sure the "Send form definition with item" box on the (Properties) tab of the form is *not* checked. [1]

-- For in-house corporate use with Exchange Server, publish the form to the Organization Forms library or a public folder's forms library, as appropriate for your application.

-- For collaboration via the Internet, publish your form to your Personal Forms library. Save it as an .oft file and send it to other people who need to use it with instructions to publish it with the same form name that you used.

-- Set the Forward action on a custom form's (Actions) page to the published custom form.

Many other things can cause one-off forms. If the above steps don't work on a new item created with your form, see http://www.outlookcode.com/d/formpub.htm#oneoff for other possible causes.

[1] Whenever you publish a message form, Outlook will suggest that you may want to check the "Send form definition with item" box to ensure that the recipient will have the form, especially if you're sending to someone via the Internet. In the current Outlook security environment, this suggestion is obsolete. Ignore it unless your form has no code behind it.
 
B

BradC

Yes I checked your first point and it is/was not ticked.

I want to host the form on an intranet site so publishing it is not really
an option however lookis like my only one...

One way around this is if I could set the To field using the If statements
(or similar) that I post in my code, I did try this but as there are 13 If
statements it sis not work.

Thanks for your help Sue =)

Sue Mosher said:
I see nothing in your code that would one-off the form. Did you look into all the issues on my earlier list, especially the first 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


BradC said:
Thanks. Now understand why its not working.

Do you mind looking at my code to see if you can find anything that would
"one-off" it? Thought is would be Item.Send or Item.To but removing these
did not allow it to work.

Code...

If the form runs code when you use Run This Form in design mode, but doesn't run code after you have sent or saved an item using the published form, you probably have done something to "one-off" the form. Outlook 2003, Outlook 2002, Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update will not run code on one-off forms; see http://www.outlookcode.com/d/secforms.htm for more information on this issue.

To ensure that a form does not one-off:

-- Make sure the "Send form definition with item" box on the (Properties) tab of the form is *not* checked. [1]

-- For in-house corporate use with Exchange Server, publish the form to the Organization Forms library or a public folder's forms library, as appropriate for your application.

-- For collaboration via the Internet, publish your form to your Personal Forms library. Save it as an .oft file and send it to other people who need to use it with instructions to publish it with the same form name that you used.

-- Set the Forward action on a custom form's (Actions) page to the published custom form.

Many other things can cause one-off forms. If the above steps don't work on a new item created with your form, see http://www.outlookcode.com/d/formpub.htm#oneoff for other possible causes.

[1] Whenever you publish a message form, Outlook will suggest that you may want to check the "Send form definition with item" box to ensure that the recipient will have the form, especially if you're sending to someone via the Internet. In the current Outlook security environment, this suggestion is obsolete. Ignore it unless your form has no code behind it.


BradC said:
A form I have designed uses a button to send it, the button checks fields
are data and selects the To field contents depending on dropdown boxes. The
button works if I am in design view and go Run this form but if I open a save
version the button does nothing!

Any idea what is going on?
 
S

Sue Mosher [MVP-Outlook]

Publishing is required if you want the form to run code.

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


BradC said:
Yes I checked your first point and it is/was not ticked.

I want to host the form on an intranet site so publishing it is not really
an option however lookis like my only one...

One way around this is if I could set the To field using the If statements
(or similar) that I post in my code, I did try this but as there are 13 If
statements it sis not work.

Thanks for your help Sue =)

Sue Mosher said:
I see nothing in your code that would one-off the form. Did you look into all the issues on my earlier list, especially the first one?

BradC said:
Thanks. Now understand why its not working.

Do you mind looking at my code to see if you can find anything that would
"one-off" it? Thought is would be Item.Send or Item.To but removing these
did not allow it to work.

Code...

If the form runs code when you use Run This Form in design mode, but doesn't run code after you have sent or saved an item using the published form, you probably have done something to "one-off" the form. Outlook 2003, Outlook 2002, Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update will not run code on one-off forms; see http://www.outlookcode.com/d/secforms.htm for more information on this issue.

To ensure that a form does not one-off:

-- Make sure the "Send form definition with item" box on the (Properties) tab of the form is *not* checked. [1]

-- For in-house corporate use with Exchange Server, publish the form to the Organization Forms library or a public folder's forms library, as appropriate for your application.

-- For collaboration via the Internet, publish your form to your Personal Forms library. Save it as an .oft file and send it to other people who need to use it with instructions to publish it with the same form name that you used.

-- Set the Forward action on a custom form's (Actions) page to the published custom form.

Many other things can cause one-off forms. If the above steps don't work on a new item created with your form, see http://www.outlookcode.com/d/formpub.htm#oneoff for other possible causes.

[1] Whenever you publish a message form, Outlook will suggest that you may want to check the "Send form definition with item" box to ensure that the recipient will have the form, especially if you're sending to someone via the Internet. In the current Outlook security environment, this suggestion is obsolete. Ignore it unless your form has no code behind it.


BradC said:
A form I have designed uses a button to send it, the button checks fields
are data and selects the To field contents depending on dropdown boxes. The
button works if I am in design view and go Run this form but if I open a save
version the button does nothing!

Any idea what is going on?
 

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