Our company has a program that is funded by the Government, that basically will pay upto $200 towards Health care, $75 towards Dental care, and $75 towards Rx, per year and per Migrant farmworker. The company has a fiscal year from 7/01 to 6/30, which each 7/01 each migrant farmworker is then eligible again for the $$ listed above.
I have a form with a subform. The subform's record source is based on a crosstab query from a table called [Voucher Data Table]. Crosstab's sql follows:
TRANSFORM CCur(Nz(Sum([Voucher Data Table].[Amount Issued]),0)) AS [SumOfAmount Issued]
SELECT [Patient Information Table].pID
FROM [Voucher Data Table] RIGHT JOIN [Patient Information Table] ON [Voucher Data Table].pID = [Patient Information Table].pID
GROUP BY [Voucher Data Table].pID, [Patient Information Table].pID
PIVOT [Voucher Data Table].tID In ("1","2","3");
1,2,3 are medical, dental, and Rx, respectively. I also have a field in the [Voucher Data Table] called [Date Issued] which I could add to the crosstab query with the "Where" criteria.
I would like to have a combo box on the main form that would list the calendar years, and when selected would filter the subform so it only added the [SumOfAmount] for that calendar year.
Would it be easier to use a filter or a global variable (which I have never done). This seemed like such an easy thing but has had me going in circles for the last couple of days. I have reviewed several types of global variables and filter queries, but could not find any that fit this scenerio.
I would of course need to be able to run reports based on this criteria(that's why I thought a global variable would be better than a form filter). Please help, you guys are great at this stuff.
I have a form with a subform. The subform's record source is based on a crosstab query from a table called [Voucher Data Table]. Crosstab's sql follows:
TRANSFORM CCur(Nz(Sum([Voucher Data Table].[Amount Issued]),0)) AS [SumOfAmount Issued]
SELECT [Patient Information Table].pID
FROM [Voucher Data Table] RIGHT JOIN [Patient Information Table] ON [Voucher Data Table].pID = [Patient Information Table].pID
GROUP BY [Voucher Data Table].pID, [Patient Information Table].pID
PIVOT [Voucher Data Table].tID In ("1","2","3");
1,2,3 are medical, dental, and Rx, respectively. I also have a field in the [Voucher Data Table] called [Date Issued] which I could add to the crosstab query with the "Where" criteria.
I would like to have a combo box on the main form that would list the calendar years, and when selected would filter the subform so it only added the [SumOfAmount] for that calendar year.
Would it be easier to use a filter or a global variable (which I have never done). This seemed like such an easy thing but has had me going in circles for the last couple of days. I have reviewed several types of global variables and filter queries, but could not find any that fit this scenerio.
I would of course need to be able to run reports based on this criteria(that's why I thought a global variable would be better than a form filter). Please help, you guys are great at this stuff.