下面的示例显示如何使用 Currentrecord 属性来确定所显示的当前记录的记录编号。在通用过程 Currentformrecord 中将当前记录的编号值赋给变量 Lngrecordnum。 Sub CurrentFormRecord(frm As Form) Dim lngrecordnum As Long lngrecordnum = frm.CurrentRecord '
[plain] view plaincopy '拼写删除指定PR Number的SQL文 stSql = "DELETE FROM [000_BASTS] WHERE [PR NR] = '" & pr_nr & "'"'执行SQL文 CurrentDb.Execute (stSql)你的问题在於,你的代码本身就只执行了一次delete动作,用个循环就可以了,With rsDo Until rs.EOF.Delete.MoveNextLoop...
Private Sub Form_Timer() ---窗体计时器事件 Acchelp_FindStrRecord (g_CurrentSelectStrID) ---利用平台函数acchelp_findstrrecord找到修改前鼠标所选择的记录 '计时器执行一次后不再执行 Me.TimerInterval = 0 ---设定刷新时间为0 End Sub Public Sub btnDel() ---删除代码 If MsgBox("您确认要删除吗?"...
On Error Resume Next DoCmd.SetWarnings (False) DoCmd.RunCommand acCmdDeleteRecord MsgBox "删除成功" DoCmd.Close acForm, Me.Name If Error.Number <> 0 Then MsgBox Error.Description End If End Sub Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo 数据更新前提醒...
Private Sub Form_Delete(Cancel As Integer) Cancel = True MsgBox "This record can't be deleted." End Sub Support and feedbackHave questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and ...
del_sql = "Delete From 奖励表" DoCmd.RunSQL del_sql Dim update_sql As String update_sql = "insert into 奖励表 select * From 奖励备份表" DoCmd.RunSQL update_sql End Sub Sub 抽奖1() On Error GoTo 抽奖完成 If a1 = 1 Then
If SQL Server returns an error message saying it does not know which record to delete, you may need to add a delete trigger on the view. Finally, you can't use the ORDER BY clause as you can with an Access query. For more information, see Views and Create indexed ...
TheDeactivateevent occurs when a form loses the focus to a Table, Query, Form, Report, Macro, or Module window, or to the Database window. Delete Occurs when the user performs some action, such as pressing the DEL key, to delete a record, but before the record is actually deleted. ...
CurrentUser -D DATABASE DATE DATETIME DELETE DESC Description DISALLOW DISTINCT DISTINCTROW Document DOUBLE DROP -E Echo Else End Eqv Error EXISTS Exit -F FALSE Field, Fields FillCache FLOAT, FLOAT4, FLOAT8 FOREIGN Form, Forms FROM Full FUNCTION -G GENERAL GetObject GetOption GotoPage GROUP ...
When possible, use action queries instead of looping through recordsets in VBA to update or delete batches of data. When you need to use a DAO snapshot recordset (or a static recordset using ADO) and you don't need to move backward in the recordset, use a forward-scrolling snapshot (or...