Hi everybody. This probably have a simple solution, but I can't find my way out here.
I need my Access 2007 database users to select "Month" or "Quarter" or "Year" in the Option Group in a form and pass that selection to the "RegDate" criteria field (Date field type) of a query.
What I try to accomplish here is to limit the quantity of Reports, because they are a lot and each one of they are needed by Month, by Quarter and by Year. Can you imagine, more than 20 Reports and all of them by month, quarter and year!? This simply is crazy!
I try an OptionGroup named "ReportType" with the 3 options: By Month, By Quarter and By Year and AfterUpdate Macro with SetValue of the criteria of the Query with different values for each option:
For By Month:
[ReportType] = 1, SetValue: Item: all the path to the Query Criteria, Value: Year([RegDate]) = Year(Now()) And Month([RegDate]) = Month(Now())
For By Quarter:
[ReportType] = 2, SetValue: Item: all the path to the Query Criteria, Value:
Year([RegDate]) = Year(Now()) And DatePart("q", [RegDate]) = DatePart("q", Now())
and For By Year:
[ReportType] = 3, SetValue: Item: all the path to the Query Criteria, Value:
Year([RegDate]) = Year(Now())
...Don't work!
Try creating a TexBox named Criteria in the form where is the OptionGroup and make selected option change Criteria according explained up, for month, etc. And make the query to read the criteria value from the texbox in the form....Don't work.
Simply.....I don't know what to do.
So, please if anyone can suggest a solution!
Thank you, thank you a lot in advance!
I need my Access 2007 database users to select "Month" or "Quarter" or "Year" in the Option Group in a form and pass that selection to the "RegDate" criteria field (Date field type) of a query.
What I try to accomplish here is to limit the quantity of Reports, because they are a lot and each one of they are needed by Month, by Quarter and by Year. Can you imagine, more than 20 Reports and all of them by month, quarter and year!? This simply is crazy!
I try an OptionGroup named "ReportType" with the 3 options: By Month, By Quarter and By Year and AfterUpdate Macro with SetValue of the criteria of the Query with different values for each option:
For By Month:
[ReportType] = 1, SetValue: Item: all the path to the Query Criteria, Value: Year([RegDate]) = Year(Now()) And Month([RegDate]) = Month(Now())
For By Quarter:
[ReportType] = 2, SetValue: Item: all the path to the Query Criteria, Value:
Year([RegDate]) = Year(Now()) And DatePart("q", [RegDate]) = DatePart("q", Now())
and For By Year:
[ReportType] = 3, SetValue: Item: all the path to the Query Criteria, Value:
Year([RegDate]) = Year(Now())
...Don't work!
Try creating a TexBox named Criteria in the form where is the OptionGroup and make selected option change Criteria according explained up, for month, etc. And make the query to read the criteria value from the texbox in the form....Don't work.
Simply.....I don't know what to do.
So, please if anyone can suggest a solution!
Thank you, thank you a lot in advance!