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

VBSCRIPT Validate



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 20th 07, 11:10 PM posted to microsoft.public.outlook.program_forms
Juls
external usenet poster
 
Posts: 9
Default VBSCRIPT Validate

Hi, for my custom form I have the following code:

Sub Item_Write()
If Item.UserProperties("Development Completed") #1/1/4501# and _
Item.UserProperties("Version Changed") = "" Then
msgbox ("error")
End If
End Sub

Currently when this clasue is trapped a message box appears showing an error
so I know the syntax is correct. At this point how do I
a) Prevent the form from being closed
b) Navigate the user to the field that is causing the error.

Thank-you/
  #2  
Old March 20th 07, 11:40 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default VBSCRIPT Validate

a) Rewrite the procedure as a Function (which the Script | Event Handler command in the form code window would have done for you) and add an Item_write = False statement where you want the item not to be saved.

b) Use the SetFocus method on the desired control. See http://www.outlookcode.com/d/propsyntax.htm#unbound if you need a primer on control syntax. s

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Juls" wrote in message news
Hi, for my custom form I have the following code:

Sub Item_Write()
If Item.UserProperties("Development Completed") #1/1/4501# and _
Item.UserProperties("Version Changed") = "" Then
msgbox ("error")
End If
End Sub

Currently when this clasue is trapped a message box appears showing an error
so I know the syntax is correct. At this point how do I
a) Prevent the form from being closed
b) Navigate the user to the field that is causing the error.

Thank-you/

  #3  
Old March 21st 07, 02:06 AM posted to microsoft.public.outlook.program_forms
Juls
external usenet poster
 
Posts: 9
Default VBSCRIPT Validate

Thanks - can I also programmatically change to the tab with the field in
question ?

"Sue Mosher [MVP-Outlook]" wrote:

a) Rewrite the procedure as a Function (which the Script | Event Handler command in the form code window would have done for you) and add an Item_write = False statement where you want the item not to be saved.

b) Use the SetFocus method on the desired control. See http://www.outlookcode.com/d/propsyntax.htm#unbound if you need a primer on control syntax. s

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Juls" wrote in message news
Hi, for my custom form I have the following code:

Sub Item_Write()
If Item.UserProperties("Development Completed") #1/1/4501# and _
Item.UserProperties("Version Changed") = "" Then
msgbox ("error")
End If
End Sub

Currently when this clasue is trapped a message box appears showing an error
so I know the syntax is correct. At this point how do I
a) Prevent the form from being closed
b) Navigate the user to the field that is causing the error.

Thank-you/


  #4  
Old March 21st 07, 03:30 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default VBSCRIPT Validate

Yes, using the Inspector.SetCurrentFormPage method. (You do know about the object browser, right? F2 in VBA)

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Juls" wrote in message ...
Thanks - can I also programmatically change to the tab with the field in
question ?

"Sue Mosher [MVP-Outlook]" wrote:

a) Rewrite the procedure as a Function (which the Script | Event Handler command in the form code window would have done for you) and add an Item_write = False statement where you want the item not to be saved.

b) Use the SetFocus method on the desired control. See http://www.outlookcode.com/d/propsyntax.htm#unbound if you need a primer on control syntax. s



"Juls" wrote in message news
Hi, for my custom form I have the following code:

Sub Item_Write()
If Item.UserProperties("Development Completed") #1/1/4501# and _
Item.UserProperties("Version Changed") = "" Then
msgbox ("error")
End If
End Sub

Currently when this clasue is trapped a message box appears showing an error
so I know the syntax is correct. At this point how do I
a) Prevent the form from being closed
b) Navigate the user to the field that is causing the error.

Thank-you/


  #5  
Old March 22nd 07, 04:31 AM posted to microsoft.public.outlook.program_forms
Juls
external usenet poster
 
Posts: 9
Default VBSCRIPT Validate

I do now thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Yes, using the Inspector.SetCurrentFormPage method. (You do know about the object browser, right? F2 in VBA)

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Juls" wrote in message ...
Thanks - can I also programmatically change to the tab with the field in
question ?

"Sue Mosher [MVP-Outlook]" wrote:

a) Rewrite the procedure as a Function (which the Script | Event Handler command in the form code window would have done for you) and add an Item_write = False statement where you want the item not to be saved.

b) Use the SetFocus method on the desired control. See http://www.outlookcode.com/d/propsyntax.htm#unbound if you need a primer on control syntax. s



"Juls" wrote in message news Hi, for my custom form I have the following code:

Sub Item_Write()
If Item.UserProperties("Development Completed") #1/1/4501# and _
Item.UserProperties("Version Changed") = "" Then
msgbox ("error")
End If
End Sub

Currently when this clasue is trapped a message box appears showing an error
so I know the syntax is correct. At this point how do I
a) Prevent the form from being closed
b) Navigate the user to the field that is causing the error.

Thank-you/


 




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
How do I validate a field in a Outlook 2003 Form Zana Outlook - Using Forms 8 March 10th 07 02:46 PM
I cannot validate my Office 2007. Ingland Outlook - Installation 0 October 27th 06 05:34 PM
validate incoming messages Daniel Outlook and VBA 1 June 27th 06 07:20 PM
How to validate character length Bruce Manley Outlook - Using Forms 1 May 16th 06 04:53 PM
How to validate a Custom Property Page Jack Zhang Add-ins for Outlook 1 February 9th 06 08:22 PM


All times are GMT +1. The time now is 08:30 PM.


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.