Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a field visible based on a value in another field? 1

Status
Not open for further replies.

tweety1201

Technical User
Oct 16, 2001
5
US
I am trying to create a legal database. I have a field titled matter type. I want to create another field contract Name. I only want the contract Name field to be visible when the value in Matter type is Contract. Is there any way to get access to do this with an embedded field in the form? Currently I have a pop up for which appears when contract is selected. My boss does not like the pop up.

Please help.

 
I will assume that the "Matter Type" field is combo box (it can work with an option group, too).

In the AfterUpdate event of the field place this code:

Private Sub MatterType_AfterUpdate()
if me.mattertype= "Contract" then
me.ContractField.Visible = true
else
me.COntractField.visile = false
end if

If MatterType is an option group then

Private Private Sub MatterType_AfterUpdate()
with me.contractfield
select case me.mattertype.value
case 1 'Contract
.visible = true
case 2 'Something else
.visible = false
case else
.visible = false
end select
end with


Either one will work - combo boxes will allow you more flexibility if there are more options for MatterType.

Oh, yeah, if its a bound field (Mattertype, that is) then place the code into the form's OnCurrent Event as well.


Hope that helps.

Bob
 
That is an interesting question (protecting a field depending on another value). I noted that this code does't work in a continuous form (where more than one record displays on the page).

I tried similar code in the 'OnFormat' Event in the Form's Detail Section. The first record in the set would set the form's values for all subsequent records.

Any advise on this?
 
I have tried the combo box code and cannot get this to work. Is there something that I'm missing?
 
Asherid,

Can you post the code that doesn't work? - - - -

Bryan
 
Bry12345,

Thanks anyway for the offering to look at the code, but I have decided to go about this in a different manner. Thanks again.

Aidan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top