Private Sub Command0_Click()
Dim OBJ As AccessObject
For Each OBJ In CurrentData.AllQueries
If OBJ.name = "ABC" Then DoCmd.DeleteObject acQuery, OBJ.name
Next
Dim strSQL As String
strSQL = "CREATE VIEW ABC AS " _
& "SELECT 表名.记录年, count(记录年) AS num " _
& "FROM " & 组合框.Value _
& " GROUP BY 记录年 " _
& "ORDER BY 记录年; "
Dim ADO As New ADODB.Command
ADO.ActiveConnection = CurrentProject.Connection
ADO.CommandText = strSQL
ADO.Execute
DoCmd.OpenQuery "ABC"
End Sub