Need help with creating querydef

  • Thread starter Thread starter EManning
  • Start date Start date
E

EManning

Using A2K. I've got a report grouped on fund number. For each fund, I want
the current month total spent and YTD total spent. The user selects what
fund numbers they want and then they enter the month desired. The report is
displaying the current month total just fine...it's the YTD total I can't
get right. If only one fund is selected, then the YTD total is fine. If
more than one fund then the 1st fund's YTD total get copied to the other
funds' YTD total.

I have a stored query to do the current month. I have a querydef in the
code to do the YTD because I have to total from the beginning of the fiscal
year....so I have to compute July 1, 20XX. (I can post the code upon
request).

Debug shows that the querydef is being created with the correct fund # each
time the fund number changes. I thought maybe the query had to be run first
so I tried that with the following code:

qdf.Execute "qselYTDDeposits_rptMonthlyStatements"

But it didn't solve my problem.

Any advice or help would be appreciated. Thanks.
 
Besides grouping on fund number, also group on month. For both fund number and
month, also create a group footer. For each fund number, you can then get the
total for each month with the appropriate formula in a textbox in the month
footer. Add a second textbox for monthly total and set the running sum property
to True and you will get the YTD total each month.
 
By "appropriate formula" I assume you mean the fiscal year calculation?
This database contains several years worth of data and I only want the
current fiscal years' data computed in the YTD total.
 
You have misread my reply. Appropriate formula refers to getting the total for
each month. Running sum is used to get the YTD total each month.

Steve
PC Datasheet
 
Back
Top