看板 Visual_Basic 關於我們 聯絡資訊
不好意思 附上一小段的程式. 希望大家可以幫我看看. >"< 找出第二次不能正確執行的原因 Private Sub Combo0_Change() Dim stDocName As String Dim fun_obj_OpenRecord As DAO.Recordset CurrentDb.Execute "DELETE FROM 資料表0" '-------------------------------------------------------' ' 查詢條件組合 '-------------------------------------------------------' stDocName = "" If Trim(Combo0.Value) <> "" Then stDocName = stDocName + IIf(Trim(stDocName) <> "", " And ", "") & _ " (欄位1 = '" & Trim(Combo0.Value) & "')" End If CurrentDb.Execute "INSERT INTO 資料表0 (欄位1) " & _ " SELECT 欄位1 FROM 總資料表 " & _ IIf(Trim(stDocName) <> "", " WHERE " & Trim(stDocName), "") & _ " GROUP BY 欄位1" Set fun_obj_OpenRecord = CurrentDb.OpenRecordset("SELECT * FROM 資料表0 ") fun_obj_OpenRecord.Close DoCmd.GoToControl ("Combo2") End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 202.39.173.66