Connecting Tech Pros Worldwide Help | Site Map

Data Access Page - how to change visibility based on criteria?

Newbie
 
Join Date: Oct 2008
Posts: 11
#1: Oct 30 '08
Hi - I'm putting together a status report summary for a team of about 15 based in the US (various places), London, Hong Kong, etc. The users have expressed interest in using a web form (data access page), which I have submitting data to an Access db on a shared network repository. They want the forms to be saved in a Sharepoint repository for easy access. So far, so good.

Where I need a little help is in setting the data access page to hide or show some controls based on the type of update being submitted. For example, if they select the option "OUTAGE" from a combobox control, I want to show fields A, B and C, but hide X, Y and Z.

I'm sure I could convince them to ditch Sharepoint and just put a shortcut to a form (instead of the data access page), but I'd like to give them what they asked for if it's possible.

Thank you for any help!
JP
DonRayner's Avatar
Expert
 
Join Date: Sep 2008
Location: Canada
Posts: 494
#2: Oct 30 '08

re: Data Access Page - how to change visibility based on criteria?


Quote:

Originally Posted by JP Romano

Hi - I'm putting together a status report summary for a team of about 15 based in the US (various places), London, Hong Kong, etc. The users have expressed interest in using a web form (data access page), which I have submitting data to an Access db on a shared network repository. They want the forms to be saved in a Sharepoint repository for easy access. So far, so good.

Where I need a little help is in setting the data access page to hide or show some controls based on the type of update being submitted. For example, if they select the option "OUTAGE" from a combobox control, I want to show fields A, B and C, but hide X, Y and Z.

I'm sure I could convince them to ditch Sharepoint and just put a shortcut to a form (instead of the data access page), but I'd like to give them what they asked for if it's possible.

Thank you for any help!
JP

in the "After Update" event procedure for the combobox control use either IF or Select Case arguments to set each of the fields visible properties based on the value of the combobox. Eg:
Expand|Select|Wrap|Line Numbers
  1. If me.combobox = "update1" then
  2.   me.control1.visible = true
  3.   me.control2.visible = false
  4. Elseif me.combobox = "update2" then
  5.   me.control1.visible = false
  6.   me.control2.visible = true
  7. Elseif...... (up to however many selections you have)
  8.  
  9. Else
  10.   me.control1.visible = false
  11.   me.control2.visible = false
  12. End If
  13.  
Or with a Case statement
Expand|Select|Wrap|Line Numbers
  1. Dim mycontrol as string
  2. mycontrol = me.combobox.value
  3. select case mycontrol
  4.   case "update1"
  5.     me.control1.visible = true
  6.     me.control2.visible = false
  7.   case "update2"
  8.     me.control1.visible = false
  9.     me.control2.visible = true
  10.   case....(up to however many selections you have)
  11.  
  12.   case else
  13.     me.control1.visible = false
  14.     me.control2.visible = false
  15. End Select
  16.  
Newbie
 
Join Date: Oct 2008
Posts: 11
#3: Nov 10 '08

re: Data Access Page - how to change visibility based on criteria?


This is fantastic! Thanks a million
DonRayner's Avatar
Expert
 
Join Date: Sep 2008
Location: Canada
Posts: 494
#4: Nov 11 '08

re: Data Access Page - how to change visibility based on criteria?


Glad I could be of some help
Reply