Solved

Outlook forms pt.2

Posted on 2004-05-03
2
242 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
2 Comments
 
LVL 13

Accepted Solution

by:
stefri earned 150 total points
Comment Utility
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
Comment Utility
Thanx again stefri! :D
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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: …

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now