?
Solved

Outlook forms pt.2

Posted on 2004-05-03
2
Medium Priority
?
249 Views
Last Modified: 2010-04-08
Stefri helped me on this http:Q_20974139.html

I have one thing I'd like to adjust:
I'd like the "comments" box to be hidden unless Deny is clicked...
0
Comment
Question by:sirbounty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
stefri earned 600 total points
ID: 10980390
There you are....
Replace the code in Script Editor
Maybe will you have to clear the form cache
Stefri

Option Explicit

dim myControls
dim reqBusApp
dim reqBusden
dim reqUseApp
dim reqUseDen
dim uComments
dim busUse
dim appDen
dim theBody
dim myReply
dim defComments
dim theText
dim tmpText
dim theAmount
sub approved_click() ' <<<<<<<<<<<<<< added to handle aproved click
      if myControls.item("approved").value = true then
            myControls.item("comments").visible = false
      else
            myControls.item("comments").visible = true
      end if
end sub
sub denied_click()' <<<<<<<<<<< added to handle denied click
      if myControls.item("approved").value = true then
            myControls.item("comments").visible = false
      else
            myControls.item("comments").visible = true
      end if
end sub
sub submit_click()
' check all mandatory fields
dim strError
dim appDen

dim ok
ok = true
appDen = ""
strError = "Missing "
if myControls.item("SHARENAME").value = "" and  myControls.item("business").value then
      ok = false
      strError = strError & chr(13) & "Sharename"
end if
if myControls.item("AMOUNT").value = "" and  myControls.item("approved").value then
      ok = false
      strError = strError & chr(13) & "Amount"
end if
if myControls.item("TICKET").value = "" then
      ok = false
      strError = strError & chr(13) & "Ticket"
end if

if ok then
      ' get approved/denied
      if myControls.item("approved").value = true then
            appDen = true
      elseif myControls.item("denied").value = true then
            appDen = false
      else
            msgbox "Select Approved or Denied", 16
            exit sub
      end if
      if myControls.item("business").value = true then
            busUse = true
      elseif myControls.item("user").value = true then
            busUse = false
      else
            msgbox "Select Business or User", 16
            exit sub
      end if

else
      msgbox strError, 16 ' vbcritical
      exit sub
end if
      set myReply = application.createItem(0)
      myreply.Subject = "Ticket #: " & myControls.item("Ticket").value
      theBody = "Support Personnel"
      if busUse then
            if appDen = true then
                  if myControls.item("MB") = true then
                        theAmount = myControls.item("AMOUNT") & " MB "
                  else
                        theAmount = myControls.item("AMOUNT") & " GB "
                  end if
                  theText = replace(reqBusApp,"$SHARENAME$", myControls.item("SHARENAME"))
                  tmpText = replace(theText,"$AMOUNT$", theAmount  )
                  myReply.body = tmpText & chr(13) & theBody
            else
                  theText = replace(reqBusDen,"$SHARENAME$", myControls.item("SHARENAME"))
                  defComments = " "
                  if myControls.item("COMMENTS") <> "" then
                        defComments = chr(13) & "Reason:" & chr(13) & myControls.item("COMMENTS")
                  end if
                  tmpText = replace(theText,"$COMMENTS$", defComments )
                  myReply.body = tmpText & chr(13) & theBody
            end if
      else
            if appDen = true then
                  if myControls.item("MB") = true then
                        theAmount = myControls.item("AMOUNT") & " MB "
                  else
                        theAmount = myControls.item("AMOUNT") & " GB "
                  end if
                  theText = replace(reqUseApp,"$SHARENAME$", myControls.item("SHARENAME"))
                  tmpText = replace(theText,"$AMOUNT$", theAmount)
                  myReply.body = tmpText & chr(13) & theBody
            else
                  theText = replace(reqUseDen,"$SHARENAME$", myControls.item("SHARENAME"))
                  defComments = chr(13) & "Reason:" & chr(13) & uComments
                  if myControls.item("COMMENTS") <> "" then
                        defComments = hr(13) & "Reason:" & chr(13) & myControls.item("COMMENTS")
                  end if
                  tmpText = replace(theText,"$COMMENTS$", defComments)
                  myReply.body = tmpText & chr(13) & theBody
            end if
      end if
      myReply.display true
end sub

sub item_open()
      ' get controls on modified page labeled Approve Increase
dim myInspector
dim myPage
set myInspector = Item.getInspector
set myPage = myInspector.ModifiedFormPages("Approve Increase")
set myControls = myPage.Controls
set myInspector = Nothing
set myPage = nothing
approved_click ' <<<<<<<<<<<<< Added; calls the click event when opening
reqBusApp = "Your request for additional storage capacity on  $SHARENAME$ share has been approved, effective immediately, for the $AMOUNT$ increase requested."
reqBusDen = "Your request for additional storage capacity on  $SHARENAME$ share has been denied. $COMMENTS$."
reqUseapp = "Your request for additional storage capacity on your home share (H drive) has been approved, effective immediately, for a $AMOUNT$ increase."
reqUseDen = "Your request for additional storage capacity on your home share (H drive) has been denied. $COMMENTS$"
uComments = "Home shares are limited to 200mb total quota.  If you cannot archive the data on your H drive, you will need to utilize a group share for storing this data"
end sub

   
0
 
LVL 67

Author Comment

by:sirbounty
ID: 10988607
Thanx again stefri! :D
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Changing a few Outlook Options can help keep you organized!
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question