Filter form data based on radio button selection

A

abev107

I have a form (continuous forms view) with an option group (fiv
options) in the form header. I would like to limit the data on the for
based on the radio button selected.

I am creating an employee scheduling db. The radio's in the optio
group are locations, and I would like to limit the shifts (detai
section) based on the location selected
 
N

Nikos Yannacopoulos

Open your form in design view, select your option group and in properties,
tab Events, put the cursor i line for On Change and click on the little
button with the three dots on the right hand side.Select Code Builder, and
when in the code editor window, put the line below between the "Private Sub
xxxx_Change(cancel as integer)" and "End Sub" lines that access generates
automatically:

DoCmd.ApplyFilter , "Location_ID = " & Me.OptLocation

assuming:
Location field name on form: Location_ID
Option Group name: OptLocation
Substitute as appropriate.

HTH,
Nikos
 

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