如何创建一个新的空白记录而不显示先前记录中的先前数据? [英] How to Create a new blank Record without it showing the previous data from the previous record?
问题描述
我一直在尝试创建一个新记录,期望会出现一个新的空白表格,但是会显示前一个表格中的所有信息.
I keep trying to create a new record expecting a new blank form to show up but all of the info from the previous form shows up.
我需要一个空白表格来输入数据,但我还需要保存所有以前的表格.总体而言,我想继续添加到我的记录中.但是不知何故它不会让我.
I need a blank form to enter data but i also need to save all of my previous forms. Overall, I want to keep adding onto my records. But somehow it won't let me.
推荐答案
根据您是否具有绑定形式,Kefash的答案可能有效. 但是,如果您有未绑定的表单,则不会.
Depending on whether or not you have a bound form, Kefash' answer could work. If you have an unbound form however, it will not.
如果确实有未绑定的表单,最简单的方法是只遍历所有控件并将它们清空. 例如:
If you do have an unbound form, the simplest way is to just loop through all the controls and empty them. For example:
Private Sub save_Click()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acListBox
If Len(ctl.ControlSource) = 0 Then
ctl.Value = Null
End If
Case acCheckBox
ctl.Value = 0
Case acTextBox
ctl.value = ""
End Select
Next
End Sub
这篇关于如何创建一个新的空白记录而不显示先前记录中的先前数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!