Re: Problems with Making Hidden Fields Visible Based on Values of othe



On Sun, 24 Jul 2005 18:40:03 -0700, Aaron wrote:

> I am having a problem. I Have a drop down menu of different predefined
> values. I want to set it up so that when one value is selected, I havea
> series of different fields appear. When you select anothe value, those same
> fields dissappear and the fields pertaining to the new value of the drop down
> box appear in the same place. I have Five different drop down box values
> that I need to set for. I also want to make it so that when I move on to a
> new records, the proper fields are displayed depending on what value is
> already recorded for that particular drop down box.
>
> I know it is a lot of help I need, I am fairly new to Access. I know how to
> make forms, and reports, and quiries and stuff, but I have never done coding
> in Access. I know I right click (I'm using Access 2003) and go to "Build
> Event" then choose "Build Code" and it brings me to the area to work in, but
> things I have tried don't work.

In Design view, right click on the combo box.
Click on the Event tab.
On the After Update line write
[Event Procedure]
Click on the little button with the 3 dots that appears on that line.
When the Code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write:

If Me![comboName] = Value1 Then
[ControlA].Visible = True
[ControlB].Visible = True
[ControlC].Visible = False
[ControlD].Visible = False
[ControlE].Visible = False
[ControlF].Visible = False
ElseIf Me![ComboName] = Value2 Then
[ControlA].Visible = False
[ControlB].Visible = False
[ControlC].Visible = True
[ControlD].Visible = True
[ControlE].Visible = False
[ControlF].Visible = False
Else
[ControlA].Visible = False
[ControlB].Visible = False
[ControlC].Visible = False
[ControlD].Visible = False
[ControlE].Visible = True
[ControlF].Visible = True
End if

I've only given 3 Values, just add 2 more ElseIf's as needed.
Substitute your actual control names in the above.

Then place the same code in the form's Current event.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.