Hiding and Un-Hiding Data fields

R

ROL41

I am using a form for people to select data via dropdown menus and then
having it run through a query to filter results. Is there a way that I can
have certain feilds hidden until a toggle button or something of the like is
clicked?

Basically I want have three choices of buttons: Year, Quarter, and Month.
What I ideally want to happen is when someone selects the button for year, a
hidden drop down menu appears where they can then choose from the available
years to filter through the query.

I would say I am above average with using access, but I have no idea how to
hide fields and then make them reappear using a macro or something similar. I
would appreciate any help. Thanks.
 
K

Klatuu

In design view of your form, set the combo box's Visible property to No.
Then create an option group on your form with the 3 choices. For example
let's say the option values of the 3 options are:
Year 1
Quarter 2
Month 3

Then in the After Update event of the option group frame, use a Select Case
statement to make the combo visible:

Select Case Me.opgPeriod
Case 1
Me.cboYear.Visible = True
Case 2
'Do stuff for Quarter
Case 3
'Do stuff for Month
End Select

Also, you will need to set the combo back to invisible in the form
Current Event to change options for each record.
Me.cboYear.Visible = False
 
R

ROL41

thanks a lot - im definately heading in the right direction. i have
everything up until the select case statement. So my combo box is combo12 and
its titled "fiscal year". when i start entering my statement ive typed the
Select Case Me. and then is there something i need to select from the list
they give me, or am I typing in the name of the combo box?

thanks for your help
 
R

ROL41

awesome - thank you very much. one more quick question regarding this. is
there a way for the combo box to go back tonvisible if you select a different
option from the option group? you know, if someone initially clicks year but
they actually want month so they click month and the month pops up and the
year disappears again

thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top