28/03/2020, 22:48
berduş
@feraz bey aşağıdaki kodu dener misiniz? pasif yaptığım ''''''''hy Sorguyu sütunlara böl bloğu normal tabloyu çoklu sütuna çevirmek için
Dim sql, SqlStn As String
Dim xStnSay, x As Integer
Sql = "SELECT max(SplitStnSay([Alan1])) AS [HstStn] FROM Tablo1"
CurrentDb.QueryDefs("Sorgu1").sql = sql
xStnSay = DMax("HstStn", "Sorgu1")
''''''''hy Sorguyu sütunlara böl
'''''''SqlStn = ""
'''''''For x = 1 To xStnSay
''''''' SqlStn = SqlStn & ", SplitVeriBul([Alan1]," & x - 1 & ") AS [HstStn" & CStr(x) & "]"
'''''''Next x
''''''' Sql = "SELECT Alan1, " & Mid(SqlStn, 2) & " FROM Tablo1;"
''''''' CurrentDb.QueryDefs("Sorgu1").sql = sql
''''''''hy Union
SqlStn = ""
For x = 1 To xStnSay
SqlStn = SqlStn & " union all SELECT Nz(SplitVeriBul([Alan1]," & x - 1 & "),'') AS [HstStn] from tablo1 " & _
" where Nz(SplitVeriBul([Alan1]," & x - 1 & "),'')<>''" & vbCrLf
Next x
Sql = Mid(SqlStn, 11)
Sql = " SELECT [HstStn], count([HstStn]) AS ToplamSayi FROM (" & Sql & ") as UnionQuery GROUP BY [HstStn]"
CurrentDb.QueryDefs("HstlikSay").sql = sql
DoCmd.OpenQuery "HstlikSay"
End Sub