Solved

Outlook forms pt.2

Posted on 2004-05-03
2
246 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 150 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Read this checklist to learn more about the 15 things you should never include in an email signature.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

733 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