0
我被困 - 我使用SQL並希望結果填充到列表框中。我曾嘗試以下:使用SQL填充列表框
AdvisorOverall = "SELECT TOP 5 tbl_CallLogs.Advisor, Count(tbl_CallLogs.[Date Escalated]) AS [CountOfDate Escalated]" & _
"FROM tbl_CallLogs" & _
"GROUP BY tbl_CallLogs.Advisor" & _
"HAVING (((tbl_CallLogs.Advisor) <> ""))" & _
"ORDER BY Count(tbl_CallLogs.[Date Escalated]) DESC;"
也試過:
me.list3.rowsource = "SELECT TOP 5 tbl_CallLogs.Advisor, Count(tbl_CallLogs.[Date Escalated]) AS [CountOfDate Escalated]" & _
"FROM tbl_CallLogs" & _
"GROUP BY tbl_CallLogs.Advisor" & _
"HAVING (((tbl_CallLogs.Advisor) <> ""))" & _
"ORDER BY Count(tbl_CallLogs.[Date Escalated]) DESC;"
也試過:
me.list3.rowsource = AdvisorOverall
上述每個倒退沒有錯誤的,所以不能確定我要去的地方錯了
任何幫助表示讚賞。
創建使用GUI(忘了'TOP 5'現在,一切是可行的與GUI)的查詢。看看你得到了什麼結果。一旦你在GUI中工作,複製粘貼SQL代碼表單並添加'TOP 5' – SunKnight0
另外,是否有一個原因,你試圖在VBA中做到這一點,而不是在設計模式中分配'RouSource'?在VBA中,在設置「RowSource」之後,您將不得不「查看」列表框,在看到任何更改之前。 – SunKnight0