Clear All fields after Hit the Save button

2019-07-11 03:51发布

I have working on forms, after i filled all the fields and Click on Save button, all fields have been saved but the text fields was not empty, all entered text still present, How do removed those text after hit on the save button

4条回答
劳资没心,怎么记你
2楼-- · 2019-07-11 04:07

Try this routine linked to a button you want to click to clear all textboxes in an unbound form:

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
查看更多
在下西门庆
3楼-- · 2019-07-11 04:14

Go to a new record:

DoCmd.GoToRecord , , acNewRec 
查看更多
太酷不给撩
4楼-- · 2019-07-11 04:16

May be you would like to add the following in the click on save button event before "End Sub"

Me.TextboxName.Value = Null
查看更多
一纸荒年 Trace。
5楼-- · 2019-07-11 04:32
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

Try this is in your save records click event.

查看更多
登录 后发表回答