我已经处理了表单,在填写所有字段并单击“保存”按钮后,所有字段都已保存,但文本字段不为空,所有输入的文本仍然存在,如何在保存按钮上点击后删除这些文本
转到新记录:
DoCmd.GoToRecord , , acNewRec
可能是您想在“End Sub”之前点击“保存”按钮事件添加以下内容
Me.TextboxName.Value = Null
尝试将此例程链接到要单击的按钮以清除未绑定表单中的所有文本框:
Private Sub CleanAllFieldsButton_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then ctl = Null
Next
Set ctl = Nothing
End Sub
Private Sub Command47_Click()
On Error Resume Next
Me.Dirty = False 'Attempt to save the record
If Err.Number = 0 Then
'Only enter a new record, leaving other newly-added record accessible
DoCmd.GoToRecord , , acNewRec
Else MsgBox Err.DESCRIPTION, vbCritical, "Error"
End If
End Sub
尝试这是在您的保存记录点击事件。