Hide pages on MultiPage control based on Option selected

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jim Fazakas (jim_at_fazakas.net)
Date: 10/27/04


Date: 27 Oct 2004 09:58:52 -0700

I am putting together a customer message form and have a MultiPage
control with pages "Page1", "Page2", and "Page3". I also have an
OptionButton control within a frame called "frmSelectRecordType". I
want to hide pages "Page2" and "Page3" if the value of the "Select
Record Type" field is "Outage". If the value is "Change", then I want
to hide pages "Page1" and "Page3".

The script below that I am using runs without error, but doesn't give
me the results I am looking for. I not that familiar with VBscript.
Any ideas on what might be wrong with the script is appreciated.
Thanks!

Function Item_Open()

Dim objPageTwo
Dim objOutageTab
Dim objChangeTab
Dim objMemoTab
Dim objSelectRecordType

 Set objPageTwo = Item.GetInspector.ModifiedFormPages("P.2").Controls
 Set objOutageTab = objPageTwo("Multipage1").Pages("Page1")
 Set objChangeTab = objPageTwo("Multipage1").Pages("Page2")
 Set objMemoTab = objPageTwo("Multipage1").Pages("Page3")
 Set objSelectRecordType = objPageTwo("frmSelectRecordType")

  If UserProperties.item("Select Record Type").value = "Outage" THEN
   objOutageTab.visible = True
   objChangeTab.visible = False
   objMemoTab.visible = False
  
  ElseIf UserProperties.item("Select Record Type").value = "Change"
THEN
   objOutageTab.visible = False
   objChangeTab.visible = True
   objMemoTab.visible = False

  ElseIf UserProperties.item("Select Record Type").value = "Memo" THEN
   objOutageTab.visible = False
   objChangeTab.visible = False
   objMemoTab.visible = True

  Else
   objOutageTab.visible = True
   objChangeTab.visible = True
   objMemoTab.visible = True

  End If

End Function


Quantcast