Hello everyone!
First and foremost, my apologies for the title of the post. It is not very clarifying of what the problem is about, but I didn't know how to put it...
My problem is as follows: I have a parameter query consisting of 2 fields (month and year). The parameter prompts the user to enter the month and the year, that is, [Please enter the month/year]. When both are entered, there is no problem. Nevertheless, users may want only to enter the year, so as to display all records for that year. Then, I have specified the query criteria as follows:
Fields: Month, Year
Display: both displayed
Criteria 1: [Please enter month] and [Please enter year] :::> Month and yr provided
Criteria 2: [Please enter year] :::> Only yr provided.
But in the first case (entering month and year), those records matching with the year but not with the month will also be displayed.
Is there a way to block the query in a way that if month and year are provided, only those records with the matching month and year will be displayed and not those only matching the year? Is code needed?
I feel I am doing something wrong here, with Access itself (without using any code...).
Best regards.
First and foremost, my apologies for the title of the post. It is not very clarifying of what the problem is about, but I didn't know how to put it...
My problem is as follows: I have a parameter query consisting of 2 fields (month and year). The parameter prompts the user to enter the month and the year, that is, [Please enter the month/year]. When both are entered, there is no problem. Nevertheless, users may want only to enter the year, so as to display all records for that year. Then, I have specified the query criteria as follows:
Fields: Month, Year
Display: both displayed
Criteria 1: [Please enter month] and [Please enter year] :::> Month and yr provided
Criteria 2: [Please enter year] :::> Only yr provided.
But in the first case (entering month and year), those records matching with the year but not with the month will also be displayed.
Is there a way to block the query in a way that if month and year are provided, only those records with the matching month and year will be displayed and not those only matching the year? Is code needed?
I feel I am doing something wrong here, with Access itself (without using any code...).
Best regards.
Comment