Sağolunuz.
Alttaki kırmızı yeri eklememişsiniz yani listbox seçili olayını.
TRANSFORM bunun mantığını anlatabilirmisiniz nasıl çalışır.Accesse özgü birşey midir?
Option Compare Database
Private Sub Form_Load()
Metin1.SetFocus
End Sub
Private Sub Komut0_Click()
Application.Echo False
If IsNull(Metin1.Value) Then
MsgBox "Baþlangýç Tarihi Giriniz."
Application.Echo True
Metin1.SetFocus
Exit Sub
End If
If IsNull(Metin3.Value) Then
MsgBox "Baþlangýç Tarihi Giriniz."
Application.Echo True
Metin3.SetFocus
Exit Sub
End If
If CDbl(Metin1.Value) > CDbl(Metin3.Value) Then
MsgBox "Baþlangýç Tarihi Bitiþ Tarihinden büyük olamaz"
Application.Echo True
Metin1.Value = ""
Metin3.Value = ""
Metin1.SetFocus
Exit Sub
End If
If Liste5.ListIndex = -1 Then
MsgBox "ADI secilmedi...", vbCritical, "Hata"
Application.Echo True
Exit Sub
End If
Const strForm = "Rapor"
Const strCtl = "txtTest"
Dim frm As Form
Dim ctl As Control
Dim lbl As Control
DoCmd.OpenForm FormName:="Rapor", View:=acDesign
Set frm = Forms("Rapor")
frm.RecordSource = ""
If IsNull(Liste5.Value) Then
ek = ""
Else
ek = " AND adý='" & Liste5.Value & "'"
End If
Sql = "TRANSFORM Sum(Tablo1.say) AS Toplasay SELECT Tablo1.adý FROM Tablo1 WHERE (((Tablo1.tarih)>=" & CDbl(Metin1.Value) & ") AND ((Tablo1.tarih)<=" & CDbl(Metin3.Value) & "))" & ek & " GROUP BY Tablo1.adý PIVOT Tablo1.tarih;"
frm.RecordSource = SQL
For x = 0 To Forms("Rapor").Controls.Count - 1
DeleteControl frm.Name, frm.Controls(0).Name
DoEvents
Next
sol = 0
Dim ys As New ADODB.Recordset
ys.Open SQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If ys.Fields.Count > 32 Then
RunCommand acCmdSave
DoCmd.Close acForm, "Rapor"
MsgBox "Tarih aralýðý 31 gün ile sýnýrlýdýr."
Metin3.Value = ""
Metin3.SetFocus
Application.Echo True
Exit Sub
Else
For i = 0 To ys.Fields.Count - 1
Set ctl = CreateControl(FormName:=strForm, ControlType:=acTextBox, ColumnName:=ys.Fields(i).Name, Left:=sol, Top:=0, Width:=750, Height:=288)
ctl.Name = ys.Fields(i).Name
ctl.TextAlign = 2
Set lbl = CreateControl(FormName:=strForm, ControlType:=acLabel, Section:=acHeader, Left:=sol, Top:=0, Width:=750, Height:=450)
lbl.Name = ys.Fields(i).Name & "x"
lbl.TextAlign = 2
lbl.FontSize = 8
If i <> 0 Then
lbl.Caption = Replace(ys.Fields(i).Name, "_", " ")
Else
lbl.Caption = ys.Fields(i).Name
End If
sol = sol + 750
Next
RunCommand acCmdFormView
RunCommand acCmdSave
DoCmd.Close acForm, "StrForm"
End If
Application.Echo True
End Sub