I have several fields in my detail section that are calculated from adding the values of a bunch of database fields together. The list of fields that are added changes from month to month. So, in January, bucket 1 is for January, but in February bucket 1 is for February, and so on and so forth. We then take those buckets and add the values for to obtain totals for a given year and year to date. We show the current year and 2 previous years data in the report, so I have 6 aggregate variables, 3 for the Years' grand totals, and 3 for the YTD totals.
Now, I need to take those year total and year to date fields and give a grand total for them at the bottom of the report, a seemingly simple task that has me going nuts. Here is the gist of my code.
Dim agg_Yr1_Grand, agg_Yr2_Grand, agg_Yr3_Grand As Double
Dim agg_Yr1_YTD, agg_Yr2_YTD, agg_Yr3_YTD As Double
Private Sub Detail_Print(
agg_Yr1_Grand = agg_Yr1_Grand + Nz(Me.Ctl05)
Me.grand1 = agg_Yr1_Grand
agg_Yr1_YTD = agg_Yr1_YTD + Nz(Me.YTD2006)
Me.ytd1 = agg_Yr1_YTD
agg_Yr2_Grand = agg_Yr2_Grand + Nz(Me.Ctl06)
Me.grand2 = agg_Yr2_Grand
agg_Yr2_YTD = agg_Yr2_YTD + Nz(Me.YTD2007)
Me.ytd2 = agg_Yr2_YTD
agg_Yr3_Grand = agg_Yr3_Grand + Nz(Me.Ctl08)
Me.grand3 = agg_Yr3_Grand
agg_Yr3_YTD = agg_Yr3_YTD + Nz(Me.YTD2008)
Me.ytd3 = agg_Yr3_YTD
End Sub
Private Sub Report_Open(
agg_Yr1_Grand = 0
agg_Yr2_Grand = 0
agg_Yr3_Grand = 0
agg_Yr1_YTD = 0
agg_Yr2_YTD = 0
agg_Yr3_YTD = 0
End Sub
Everything works beautifully if I do a Print Preview, but as soon as I hit print, the totals are all out of whack. Mysteriously the totals add in extra dollars. If I sit there and click the Landscape button over and over, you can watch the totals go up and up and up and up without bound.
I've tried this in both Access 2000 and 2007, with the same result. I've tried Compacting and Repairing, with no effect. Any ideas?
Tecnologia, programação e muito Visual FoxPro.
terça-feira, 17 de novembro de 2009
[Access VBA Central] Problem with Report Totals
__._,_.___
.
__,_._,___
Assinar:
Postar comentários (Atom)
Arquivo do blog
-
▼
2009
(1549)
-
▼
novembro
(168)
- RE: {Disarmed} [usuarios_fox] LECTOR DE HUELLAS DI...
- [usuarios_fox] LECTOR DE HUELLAS DIGITALES
- Fw: ]] XL-mania [[ Bikin nomor urut di sheet excel
- [Access VBA Central] Programmically setting query ...
- [Access VBA Central] Re: Problem with Report Totals
- ]] XL-mania [[ Membuat template Kode Material & De...
- ]] XL-mania [[ Mengundi DoorPrize
- ]] XL-mania [[ excel 2007 error...
- Re: ]] XL-mania [[ Membuat Grafik Sclatter
- Re: ]] XL-mania [[ Membuat Grafik Sclatter
- ]] XL-mania [[ Membuat Grafik Sclatter
- Re: ]] XL-mania [[ Konversi Text Angka ke Bilangan...
- ]] XL-mania [[ File - rules_and_tips
- Re: ]] XL-mania [[ Makro untuk sheet terakhir
- Re: ]] XL-mania [[ Mengurutkan SubString-Angka dal...
- Re: ]] XL-mania [[ Bikin nomor urut di sheet excel
- Re: ]] XL-mania [[ Konversi Text Angka ke Bilangan...
- RE: ]] XL-mania [[ vendor list dan jumlah hutang
- ]] XL-mania [[ Konversi Text Angka ke Bilangan ter...
- Re: ]] XL-mania [[ Kunci Row Scr Otomatis
- Re: ]] XL-mania [[ Kunci Row Scr Otomatis
- Re: ]] XL-mania [[ Konversi Text Angka ke Bilangan...
- Re: ]] XL-mania [[ macro utk create worksheet ....
- Re: ]] XL-mania [[ vendor list dan jumlah hutang
- Re: ]] XL-mania [[ Makro untuk sheet terakhir
- Re: ]] XL-mania [[ Kunci Row Scr Otomatis
- Re: ]] XL-mania [[ mencari average
- Re: ]] XL-mania [[ Bikin nomor urut di sheet excel
- Re: ]] XL-mania [[ vendor list dan jumlah hutang
- Bls: ]] XL-mania [[ Makro untuk sheet terakhir
- RE: ]] XL-mania [[ Konversi Text Angka ke Bilangan...
- ]] XL-mania [[ Mengurutkan SubString-Angka dalam S...
- ]] XL-mania [[ Konversi Text Angka ke Bilangan ter...
- [usuarios_fox] Twitter
- Re: ]] XL-mania [[ Re: mencari average
- RE: [usuarios_fox] ancho de Columna de control gri...
- Re: ]] XL-mania [[ Lembur rutin dan non rutin (Sus...
- ]] XL-mania [[ vendor list dan jumlah hutang
- [usuarios_fox] ancho de Columna de control grid se...
- ]] XL-mania [[ Makro untuk sheet terakhir
- RE: [usuarios_fox] REPORT A PDF
- [Access VBA Central] Urgente** Programador VBA/Access
- RE: [usuarios_fox] REPORT A PDF
- RE: [usuarios_fox] REPORT A PDF
- Re: [usuarios_fox] REPORT A PDF
- RE: [usuarios_fox] REPORT A PDF
- [usuarios_fox] REPORT A PDF
- ]] XL-mania [[ Kunci Row Scr Otomatis
- Re: ]] XL-mania [[ makro cara copy ke file baru de...
- ]] XL-mania [[ Bikin nomor urut di sheet excel
- ]] XL-mania [[ macro utk create worksheet ....
- Re: ]] XL-mania [[ mencari average
- Re: ]] XL-mania [[ makro cara copy ke file baru de...
- Re: ]] XL-mania [[ Re: mencari average
- ]] XL-mania [[ Re: mencari average
- ]] XL-mania [[ mencari average
- Re: ]] XL-mania [[ weighted average saham untuk po...
- ]] XL-mania [[ makro cara copy ke file baru dengan...
- Re: ]] XL-mania [[ cara print sheet 3 dari sheet 1
- Re: ]] XL-mania [[ makro cannot rename excel file
- ]] XL-mania [[ macro link email
- ]] XL-mania [[ makro cannot rename excel file
- ]] XL-mania [[ cara print sheet 3 dari sheet 1
- Re: ]] XL-mania [[ Mencari posisi urutan ke berapa...
- Re: ]] XL-mania [[ MATCH & INDEX Belum Menjawab
- RE: ]] XL-mania [[ MATCH & INDEX Belum Menjawab
- RE: ]] XL-mania [[ MATCH & INDEX Belum Menjawab
- RE: ]] XL-mania [[ Lembur rutin dan non rutin (Sus...
- ]] XL-mania [[ Lembur rutin dan non rutin (Susulan...
- Re: ]] XL-mania [[ Cara ubah bulan di 21 file berbeda
- ]] XL-mania [[ MATCH & INDEX Belum Menjawab
- Re: [Access VBA Central] Programador VBA/Access Ri...
- Re: ]] XL-mania [[ membuat respons SINGLE
- [Access VBA Central] Programador VBA/Access Rio de...
- Re: ]] XL-mania [[ Mencari posisi urutan ke berapa...
- Re: ]] XL-mania [[ Mencari posisi urutan ke berapa...
- Re: ]] XL-mania [[ Mencari posisi urutan ke berapa...
- ]] XL-mania [[ membuat respons SINGLE
- Re: ]] XL-mania [[ Mencari posisi urutan ke berapa...
- ]] XL-mania [[ weighted average saham untuk portof...
- Re: ]] XL-mania [[ VBA cetak data (Auto Number)
- [Access VBA Central] Re: Problem with Report Totals
- ]] XL-mania [[ Lembur rutin dan non rutin
- ]] XL-mania [[ Mencari posisi urutan ke berapa tan...
- [Access VBA Central] Problem with Report Totals
- [Access VBA Central] Free: Very useful Magazines &...
- Re: ]] XL-mania [[ kalkulasi dinamis ??
- Re: ]] XL-mania [[ row to column pake formula
- Re: ]] XL-mania [[ Rumus aging piutang
- Re: ]] XL-mania [[ copy file ke external hardisk t...
- Re: ]] XL-mania [[ Validation lis
- Re: ]] XL-mania [[ Membuat Insial satu keluarga di...
- Re: ]] XL-mania [[ Rekap sel yang berbeda nilai
- ]] XL-mania [[ Re: kalkulasi dinamis ??
- Re: ]] XL-mania [[ kalkulasi dinamis ??
- Re: ]] XL-mania [[ file BACK UP of.xlk
- Re: ]] XL-mania [[ VBA cetak data (Auto Number)
- Re: ]] XL-mania [[ VBA cetak data (Auto Number)
- ]] XL-mania [[ Bagi Qty sesuai dengan MAX
- ]] XL-mania [[ kalkulasi dinamis ??
-
▼
novembro
(168)
Nenhum comentário:
Postar um comentário