PC Review


Reply
Thread Tools Rate Thread

Code to clear certain fields in Outlook Form

 
 
Delnang
Guest
Posts: n/a
 
      20th Jan 2010
I have a text box for employee number. This field is used to address the CC
field. If the employee number is typed incorrectly and therefore cannot be
resolved and error message show. What I'd like to do is after the message is
acknowledged by the user the employee number field, To, and CC fields are
cleared. Is there code I can add to the jscript to clear those fields?

Angie
 
Reply With Quote
 
 
 
 
Sue Mosher [MVP]
Guest
Posts: n/a
 
      20th Jan 2010
What jscript are you talking about? What error message?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Delnang" <(E-Mail Removed)> wrote in message
news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
>I have a text box for employee number. This field is used to address the
>CC
> field. If the employee number is typed incorrectly and therefore cannot
> be
> resolved and error message show. What I'd like to do is after the message
> is
> acknowledged by the user the employee number field, To, and CC fields are
> cleared. Is there code I can add to the jscript to clear those fields?
>
> Angie



 
Reply With Quote
 
Delnang
Guest
Posts: n/a
 
      20th Jan 2010
The code reads as follows:
Function Item_Send()
Const olCc = 2
Set objRecip = Item.Recipients.Add
(Item.UserProperties("ManagerEmployeeNumber2"))
If objRecip.Resolve Then
objRecip.Type = olcc
Else
MsgBox "Manager Employee Number is either not valid or blank. Please enter
a valid employee number."
Item_Send = False
End If
End Function

The error message would be what's in the MsgBox line of code.

Thanks,
Angie

"Sue Mosher [MVP]" wrote:

> What jscript are you talking about? What error message?
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Delnang" <(E-Mail Removed)> wrote in message
> news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
> >I have a text box for employee number. This field is used to address the
> >CC
> > field. If the employee number is typed incorrectly and therefore cannot
> > be
> > resolved and error message show. What I'd like to do is after the message
> > is
> > acknowledged by the user the employee number field, To, and CC fields are
> > cleared. Is there code I can add to the jscript to clear those fields?
> >
> > Angie

>
>
> .
>

 
Reply With Quote
 
Sue Mosher [MVP]
Guest
Posts: n/a
 
      20th Jan 2010
If the recipient doesn't resolve, you should be able to call
objRecip.Delete. If you want to clear all recipients (which would seem to
make more work for the user), set the value of the To and CC properties to
"".

And that's VBScript code that an Outlook form uses, not JScript.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Delnang" <(E-Mail Removed)> wrote in message
news:8C3C7313-6942-4EC5-A56F-(E-Mail Removed)...
> The code reads as follows:
> Function Item_Send()
> Const olCc = 2
> Set objRecip = Item.Recipients.Add
> (Item.UserProperties("ManagerEmployeeNumber2"))
> If objRecip.Resolve Then
> objRecip.Type = olcc
> Else
> MsgBox "Manager Employee Number is either not valid or blank. Please
> enter
> a valid employee number."
> Item_Send = False
> End If
> End Function
>
> The error message would be what's in the MsgBox line of code.
>
> Thanks,
> Angie
>
> "Sue Mosher [MVP]" wrote:
>
>> What jscript are you talking about? What error message?
>>
>> "Delnang" <(E-Mail Removed)> wrote in message
>> news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
>> >I have a text box for employee number. This field is used to address
>> >the
>> >CC
>> > field. If the employee number is typed incorrectly and therefore
>> > cannot
>> > be
>> > resolved and error message show. What I'd like to do is after the
>> > message
>> > is
>> > acknowledged by the user the employee number field, To, and CC fields
>> > are
>> > cleared. Is there code I can add to the jscript to clear those fields?



 
Reply With Quote
 
Delnang
Guest
Posts: n/a
 
      21st Jan 2010
Sue - Thank you!!! I'll remember that...VBScript not JScript. I think I
have one last question. The VBScript I have now is as follows:

Function Item_Send()
Const olCc = 2
Set objRecip = Item.Recipients.Add
(Item.UserProperties("ManagerEmployeeNumber2"))
If objRecip.Resolve Then
objRecip.Type = olcc
Else
MsgBox "Manager Employee Number is not valid, blank or contains the ""e"".
Please enter a valid employee number."
Item_Send = False
objRecip.Delete
Item.UserProperties("EmployeeNumber")= ""
End If
End Function

What is happening now, is that I can enter a valid Employee Number, but all
other fields (except the Memo field) is locked (won't let me backspace or
highlight/edit). If I were to click in the Memo field then one of the other
fields, I can edit their content. Is there a way the fields can be editible
without having to click the Memo field first?
Angie
"Sue Mosher [MVP]" wrote:

> If the recipient doesn't resolve, you should be able to call
> objRecip.Delete. If you want to clear all recipients (which would seem to
> make more work for the user), set the value of the To and CC properties to
> "".
>
> And that's VBScript code that an Outlook form uses, not JScript.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Delnang" <(E-Mail Removed)> wrote in message
> news:8C3C7313-6942-4EC5-A56F-(E-Mail Removed)...
> > The code reads as follows:
> > Function Item_Send()
> > Const olCc = 2
> > Set objRecip = Item.Recipients.Add
> > (Item.UserProperties("ManagerEmployeeNumber2"))
> > If objRecip.Resolve Then
> > objRecip.Type = olcc
> > Else
> > MsgBox "Manager Employee Number is either not valid or blank. Please
> > enter
> > a valid employee number."
> > Item_Send = False
> > End If
> > End Function
> >
> > The error message would be what's in the MsgBox line of code.
> >
> > Thanks,
> > Angie
> >
> > "Sue Mosher [MVP]" wrote:
> >
> >> What jscript are you talking about? What error message?
> >>
> >> "Delnang" <(E-Mail Removed)> wrote in message
> >> news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
> >> >I have a text box for employee number. This field is used to address
> >> >the
> >> >CC
> >> > field. If the employee number is typed incorrectly and therefore
> >> > cannot
> >> > be
> >> > resolved and error message show. What I'd like to do is after the
> >> > message
> >> > is
> >> > acknowledged by the user the employee number field, To, and CC fields
> >> > are
> >> > cleared. Is there code I can add to the jscript to clear those fields?

>
>
> .
>

 
Reply With Quote
 
Sue Mosher [MVP]
Guest
Posts: n/a
 
      21st Jan 2010
Exactly when are you seeing this problem?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Delnang" <(E-Mail Removed)> wrote in message
news:C47376BB-4E8E-4801-802E-(E-Mail Removed)...
> Sue - Thank you!!! I'll remember that...VBScript not JScript. I think I
> have one last question. The VBScript I have now is as follows:
>
> Function Item_Send()
> Const olCc = 2
> Set objRecip = Item.Recipients.Add
> (Item.UserProperties("ManagerEmployeeNumber2"))
> If objRecip.Resolve Then
> objRecip.Type = olcc
> Else
> MsgBox "Manager Employee Number is not valid, blank or contains the ""e"".
> Please enter a valid employee number."
> Item_Send = False
> objRecip.Delete
> Item.UserProperties("EmployeeNumber")= ""
> End If
> End Function
>
> What is happening now, is that I can enter a valid Employee Number, but
> all
> other fields (except the Memo field) is locked (won't let me backspace or
> highlight/edit). If I were to click in the Memo field then one of the
> other
> fields, I can edit their content. Is there a way the fields can be
> editible
> without having to click the Memo field first?
> Angie
> "Sue Mosher [MVP]" wrote:
>
>> If the recipient doesn't resolve, you should be able to call
>> objRecip.Delete. If you want to clear all recipients (which would seem to
>> make more work for the user), set the value of the To and CC properties
>> to
>> "".
>>
>> "Delnang" <(E-Mail Removed)> wrote in message
>> news:8C3C7313-6942-4EC5-A56F-(E-Mail Removed)...
>> > The code reads as follows:
>> > Function Item_Send()
>> > Const olCc = 2
>> > Set objRecip = Item.Recipients.Add
>> > (Item.UserProperties("ManagerEmployeeNumber2"))
>> > If objRecip.Resolve Then
>> > objRecip.Type = olcc
>> > Else
>> > MsgBox "Manager Employee Number is either not valid or blank. Please
>> > enter
>> > a valid employee number."
>> > Item_Send = False
>> > End If
>> > End Function
>> >
>> > The error message would be what's in the MsgBox line of code.
>> >
>> > Thanks,
>> > Angie
>> >
>> > "Sue Mosher [MVP]" wrote:
>> >
>> >> What jscript are you talking about? What error message?
>> >>
>> >> "Delnang" <(E-Mail Removed)> wrote in message
>> >> news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
>> >> >I have a text box for employee number. This field is used to address
>> >> >the
>> >> >CC
>> >> > field. If the employee number is typed incorrectly and therefore
>> >> > cannot
>> >> > be
>> >> > resolved and error message show. What I'd like to do is after the
>> >> > message
>> >> > is
>> >> > acknowledged by the user the employee number field, To, and CC
>> >> > fields
>> >> > are
>> >> > cleared. Is there code I can add to the jscript to clear those
>> >> > fields?

>>
>>
>> .
>>



 
Reply With Quote
 
Delnang
Guest
Posts: n/a
 
      22nd Jan 2010
From a user's perspective, it is right after he/she clicks the message box
which would read, "Manager Employee Number is not valid..." Once the OK
button on the "error" is clicked, their cursor goes to the employee number
field. User is allowed to type a new value in Employee Number. However, all
other fields are "locked" meaning one could put their cursor in a field /
backspace or highlight and click delete but nothing happens. However, if
(the user) clicks within the Memo field then out to one of the other fields
(i.e. name, d.o.b) the field is "unlocked" editable and one can put their
cursor in a field and backspace or highlight and click delete.

"Sue Mosher [MVP]" wrote:

> Exactly when are you seeing this problem?
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Delnang" <(E-Mail Removed)> wrote in message
> news:C47376BB-4E8E-4801-802E-(E-Mail Removed)...
> > Sue - Thank you!!! I'll remember that...VBScript not JScript. I think I
> > have one last question. The VBScript I have now is as follows:
> >
> > Function Item_Send()
> > Const olCc = 2
> > Set objRecip = Item.Recipients.Add
> > (Item.UserProperties("ManagerEmployeeNumber2"))
> > If objRecip.Resolve Then
> > objRecip.Type = olcc
> > Else
> > MsgBox "Manager Employee Number is not valid, blank or contains the ""e"".
> > Please enter a valid employee number."
> > Item_Send = False
> > objRecip.Delete
> > Item.UserProperties("EmployeeNumber")= ""
> > End If
> > End Function
> >
> > What is happening now, is that I can enter a valid Employee Number, but
> > all
> > other fields (except the Memo field) is locked (won't let me backspace or
> > highlight/edit). If I were to click in the Memo field then one of the
> > other
> > fields, I can edit their content. Is there a way the fields can be
> > editible
> > without having to click the Memo field first?
> > Angie
> > "Sue Mosher [MVP]" wrote:
> >
> >> If the recipient doesn't resolve, you should be able to call
> >> objRecip.Delete. If you want to clear all recipients (which would seem to
> >> make more work for the user), set the value of the To and CC properties
> >> to
> >> "".
> >>
> >> "Delnang" <(E-Mail Removed)> wrote in message
> >> news:8C3C7313-6942-4EC5-A56F-(E-Mail Removed)...
> >> > The code reads as follows:
> >> > Function Item_Send()
> >> > Const olCc = 2
> >> > Set objRecip = Item.Recipients.Add
> >> > (Item.UserProperties("ManagerEmployeeNumber2"))
> >> > If objRecip.Resolve Then
> >> > objRecip.Type = olcc
> >> > Else
> >> > MsgBox "Manager Employee Number is either not valid or blank. Please
> >> > enter
> >> > a valid employee number."
> >> > Item_Send = False
> >> > End If
> >> > End Function
> >> >
> >> > The error message would be what's in the MsgBox line of code.
> >> >
> >> > Thanks,
> >> > Angie
> >> >
> >> > "Sue Mosher [MVP]" wrote:
> >> >
> >> >> What jscript are you talking about? What error message?
> >> >>
> >> >> "Delnang" <(E-Mail Removed)> wrote in message
> >> >> news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
> >> >> >I have a text box for employee number. This field is used to address
> >> >> >the
> >> >> >CC
> >> >> > field. If the employee number is typed incorrectly and therefore
> >> >> > cannot
> >> >> > be
> >> >> > resolved and error message show. What I'd like to do is after the
> >> >> > message
> >> >> > is
> >> >> > acknowledged by the user the employee number field, To, and CC
> >> >> > fields
> >> >> > are
> >> >> > cleared. Is there code I can add to the jscript to clear those
> >> >> > fields?
> >>
> >>
> >> .
> >>

>
>
> .
>

 
Reply With Quote
 
Sue Mosher [MVP]
Guest
Posts: n/a
 
      22nd Jan 2010
I have no idea why other controls would be responsive, unless you have some
code on the item that sets those controls to read-only.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Delnang" <(E-Mail Removed)> wrote in message
news:82BC8B71-0164-45B3-9E66-(E-Mail Removed)...
> From a user's perspective, it is right after he/she clicks the message box
> which would read, "Manager Employee Number is not valid..." Once the OK
> button on the "error" is clicked, their cursor goes to the employee number
> field. User is allowed to type a new value in Employee Number. However,
> all
> other fields are "locked" meaning one could put their cursor in a field /
> backspace or highlight and click delete but nothing happens. However, if
> (the user) clicks within the Memo field then out to one of the other
> fields
> (i.e. name, d.o.b) the field is "unlocked" editable and one can put their
> cursor in a field and backspace or highlight and click delete.
>
>> > Sue - Thank you!!! I'll remember that...VBScript not JScript. I think
>> > I
>> > have one last question. The VBScript I have now is as follows:
>> >
>> > Function Item_Send()
>> > Const olCc = 2
>> > Set objRecip = Item.Recipients.Add
>> > (Item.UserProperties("ManagerEmployeeNumber2"))
>> > If objRecip.Resolve Then
>> > objRecip.Type = olcc
>> > Else
>> > MsgBox "Manager Employee Number is not valid, blank or contains the
>> > ""e"".
>> > Please enter a valid employee number."
>> > Item_Send = False
>> > objRecip.Delete
>> > Item.UserProperties("EmployeeNumber")= ""
>> > End If
>> > End Function
>> >
>> > What is happening now, is that I can enter a valid Employee Number, but
>> > all
>> > other fields (except the Memo field) is locked (won't let me backspace
>> > or
>> > highlight/edit). If I were to click in the Memo field then one of the
>> > other
>> > fields, I can edit their content. Is there a way the fields can be
>> > editible
>> > without having to click the Memo field first?
>> > Angie
>> > "Sue Mosher [MVP]" wrote:
>> >
>> >> If the recipient doesn't resolve, you should be able to call
>> >> objRecip.Delete. If you want to clear all recipients (which would seem
>> >> to
>> >> make more work for the user), set the value of the To and CC
>> >> properties
>> >> to
>> >> "".
>> >>
>> >> "Delnang" <(E-Mail Removed)> wrote in message
>> >> news:8C3C7313-6942-4EC5-A56F-(E-Mail Removed)...
>> >> > The code reads as follows:
>> >> > Function Item_Send()
>> >> > Const olCc = 2
>> >> > Set objRecip = Item.Recipients.Add
>> >> > (Item.UserProperties("ManagerEmployeeNumber2"))
>> >> > If objRecip.Resolve Then
>> >> > objRecip.Type = olcc
>> >> > Else
>> >> > MsgBox "Manager Employee Number is either not valid or blank.
>> >> > Please
>> >> > enter
>> >> > a valid employee number."
>> >> > Item_Send = False
>> >> > End If
>> >> > End Function
>> >> >
>> >> > The error message would be what's in the MsgBox line of code.
>> >> >
>> >> > Thanks,
>> >> > Angie
>> >> >
>> >> > "Sue Mosher [MVP]" wrote:
>> >> >
>> >> >> What jscript are you talking about? What error message?
>> >> >>
>> >> >> "Delnang" <(E-Mail Removed)> wrote in message
>> >> >> news:CFA0F717-65C2-4456-894D-(E-Mail Removed)...
>> >> >> >I have a text box for employee number. This field is used to
>> >> >> >address
>> >> >> >the
>> >> >> >CC
>> >> >> > field. If the employee number is typed incorrectly and therefore
>> >> >> > cannot
>> >> >> > be
>> >> >> > resolved and error message show. What I'd like to do is after
>> >> >> > the
>> >> >> > message
>> >> >> > is
>> >> >> > acknowledged by the user the employee number field, To, and CC
>> >> >> > fields
>> >> >> > are
>> >> >> > cleared. Is there code I can add to the jscript to clear those
>> >> >> > fields?
>> >>
>> >>
>> >> .
>> >>

>>
>>
>> .
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I automatically clear form fields when exiting form? Michelle Microsoft Word Document Management 1 10th Dec 2008 10:45 PM
Clear Fields in Form netadmin Microsoft Access Form Coding 1 21st Jan 2004 07:56 PM
Clear form fields netadmin Microsoft Access Form Coding 1 21st Jan 2004 05:00 AM
How do I clear all the fields on a form? Karen Skipper Microsoft Access 3 6th Nov 2003 09:30 PM
Clear Form Fields Nick Microsoft Access Form Coding 1 19th Aug 2003 05:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:17 PM.