Skip to main content

AccessTr.neT


Çarpraz Sorgudan Rapor oluşturma

Çarpraz Sorgudan Rapor oluşturma

Çözüldü #3
Evet güzel ve sık karşılaşılan bir problem.

Bununla ilgili çözümlerden birisi
Sn. Bilgisayarcı'nın anlattığı gibi sorguyu excel'e göndermek.

Benim kullandığım diğer çözümler ise kodlama ile sağlanabiliyor.
Crosstab Query'de kaç tane alan olduğunu ve hangi alan isimlerinin olduğunu Kod yazarak alabiliyorsunuz.

Internet'te yaptığım bir araştırmada,
Bununla ilgili bir çözüm bulmuştum.
Biraz ingilizceniz varsa çözebilirsiniz.
Yapılan şey özetle şu;
Raporda önceden sabit alanlar oluşturup,
kodla çapraz sorgudan alınan değerlere göre sırasıyla atamak.

----------------------
Title: Crosstab Query Report - asked by dhemple on 06/08/2004 12:16PM PDT
http://www.experts-exchange.com/Database...18004.html

I have a report that is populated with a crosstab query. The Column headings will change depending on the criteria selected by the user, but there will always be 5 columns.

Sample1:Product Desc 1Qtr03 2Qtr03 3Qtr03 4Qtr03
Sample2:Product Desc 3Qtr03 4Qtr03 1Qtr04 2Qtr04

------------------------------------------------------------------------------
Quote from Nic’s really old thread:
“When the selected field for the Column value can have different value's, you'll need some code to fill the columns as the value from the fields becomes the NAME of the field for the report.

Checkout this code / comment I created for another Q:

Making the columnheader and detaildata flexible is possible, but needs some Vba code in the OpenReport event.

To start, doing this you need to place the fields "coded" in the report.
The Column headings should be called "lblCol1", "lblCol2", "lblCol3", etc.
The "detail" fields should be called "Col1", "Col2", "Col3", etc.

The report query has two rowheader columns and a Total column, therefor the first field is effectively Column 4 (count starts at 0 so I used intI=3) but this could differ for you.

Make sure that the number of Columns is not bigger as the number placed. The programcode has no protection against that !

The OpenReport code:

---------------------------------------------------------------------------
Private Sub Report_Open(Cancel As Integer)
Dim intI As Integer
Dim intR As Integer

Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset(Me.RecordSource)

'Place headers
For intI = 3 To rs.Fields.Count - 1
Me("lblCol" & intI - 1).Caption = rs.Fields(intI).Name
Next intI

'Place correct controlsource
For intI = 3 To rs.Fields.Count - 1
Me("Col" & intI - 1).ControlSource = "=SUM([" & rs.Fields(intI).Name & "])"
Next intI

'Place Total field
Me.ColTotal.ControlSource = "=SUM([" & rs.Fields(2).Name & "])"

End Sub
---------------------------------------------------------------------------
The report query has two rowheader columns and a Total column, therefor the first field is effectively Column 4 (count starts at 0 so I used intI=3) but it could differ for you. PRC_Cross Nic;o)”
Bildiğini bilenin arkasından git, bildiğini bilmeyeni uyar, bilmediğini bilene öğret, bilmediğini bilmeyenden kaç.
Konfüçyüs
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Çarpraz Sorgudan Rapor oluşturma - Yazar: derebeyi - 26/12/2008, 00:49
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 26/12/2008, 12:00
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 26/12/2008, 12:11
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 26/12/2008, 12:16
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 27/12/2008, 14:14
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 28/12/2008, 23:01
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 28/01/2009, 20:01
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 29/01/2009, 18:21
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 29/01/2009, 20:14
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 30/01/2009, 02:14
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 30/01/2009, 10:59
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 30/01/2009, 14:30
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 30/01/2009, 16:54
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 30/01/2009, 17:43
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: karam - 12/03/2009, 02:50
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Kur@l - 14/06/2010, 00:49
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Subco - 29/12/2010, 15:19
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Seruz - 29/12/2010, 20:13
Cvp: Çarpraz Sorgudan Rapor oluşturma - Yazar: Subco - 30/12/2010, 15:20
Task