Re: [VBA ] 應該如何更新Combo值?

看板Visual_Basic作者 (savagechun)時間19年前 (2006/12/14 11:31), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
不好意思 附上一小段的程式. 希望大家可以幫我看看. >"< 找出第二次不能正確執行的原因 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
文章代碼(AID): #15WCM2f0 (Visual_Basic)
文章代碼(AID): #15WCM2f0 (Visual_Basic)