Private Sub del_Click()
Dim tmpid As String
 If Adodc1.Recordset.EOF = True Then
 MsgBox "請選擇記錄"
  Exit Sub
  End If
tmpid = Adodc2.Recordset.Fields(0)
  MsgBox tmpid
  If MsgBox("你是否真的要刪除當前記錄嗎", vbYesNo, "確認") = vbYes Then
    cs.Execute "delete * from user_pn where PN001=tmpid"End IfEnd Sub
 
我是想刪除datagrid1控件中查詢得到的記錄。
運行行提求cs.Execute "delete * from user_pn where PN001=tmpid"句中“*”號邊的語句錯誤。