How to Create a new blank Record without it showing the previous data from the previous record?

纵然是瞬间 提交于 2020-01-06 01:34:12

问题


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.


回答1:


If I'm understanding correctly you open a form but it is showing the data you previously entered? if it is that you want avoid seeing the previous data and just have a blank for for entry that you should set the form properties Data Entry to Yes




回答2:


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  


来源:https://stackoverflow.com/questions/24493903/how-to-create-a-new-blank-record-without-it-showing-the-previous-data-from-the-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!