Peter
Peter

Reputation: 31

Access query - filter related issues

I have a problem with ms-access query. I would like to have a review panel where we could switch quickly project using multiple filters as needed. Because of that I created access query and put a parameter under criteria filed in the column to be filtered. Parameter is taken from a field in Review_Form. It works if I put a particular number but I do not know what to input to receive all records without filtering them. I tried a few different approaches but without success. I have used e.g. examples shown in the link below: https://support.office.com/en-us/article/Apply-criteria-to-text-values-202548b6-b065-4387-800b-2456a7099bca The whole idea is shown in the attached picture: enter image description here

Please let me know if you have any suggestions, ideas how to solve it. Thank you, Piotr

Solution provided by Andre works but only if there is a 1 filter. In my case I would like to use more filters. Trying to apply any strings values as (Is Not Null) or (Like) to obtain all records for a particular filters it ends with an error as before. In other words: If I type directly inside access query sting e.g. (Is Not Null) it will work, but if I am trying to use fields inside the ViewProject form to have instead numerical values string, it results in error. Do you have any suggestion how to overcome that?

Upvotes: 0

Views: 123

Answers (1)

Andre
Andre

Reputation: 27634

An easier solution is to make the condition always TRUE when the status filter = 3

Change your WHERE condition in SQL view like so:

WHERE ((Status.id_status = Forms!ViewProject!pstatus1) OR (Forms!ViewProject!pstatus1 = 3))

Then you don't need the translation in VBA. You could also directly reference T_project_s1 in the query, and not need the sub at all.

Upvotes: 1

Related Questions