Daniel Seeger
Daniel Seeger

Reputation: 31

Open an Access form and filter the data

I have a table "tblPlantData". There is an attribute "Plant" which should be filtered for different people. Some should just see data from "PlantA" others data from "PlantB"

These people use different buttons to open the form where data is shown.

When I am using DoCmd.OpenForm "plantForm", , , "(Plant = 'PlantA')"

The user is able to use the filter to show data from PlantB. I don't want to disable filtering for the user.

I could use different queries that are filtered for different forms, but this just feels wrong.

Anybody got an idea?

Upvotes: 0

Views: 1660

Answers (1)

Daniel Seeger
Daniel Seeger

Reputation: 31

June7's recommendation from the comment to do something like this worked fine:

DoCmd.OpenForm "frmPlant"
Forms!frmPlant.RecordSource = "SELECT * FROM tblPlant WHERE  plant = 'PlantA'"

Upvotes: 1

Related Questions