以编程方式更改控件的默认值

以编程方式更改控件的默认值

问题描述:

我正在尝试使用VBA设置控件的默认值,以便当我离开表单导航并稍后返回时,默认值将是我之前设置的默认值.

I am trying to set the default of a control using VBA so that when I navigate away from the form and return later, the default value will be what I set it to previously.

我希望它能起作用:

Private Sub searchButton_Click()
    Me.searchType.DefaultValue = Me.searchType.Value
End Sub

是否可以设置控件的默认值?

只能在DesignView中对DefaultValue进行持久更改.请在此处以及艾伦·布朗(Allan Browne)的回复中此处

Persistant changes to the DefaultValue can only be made in DesignView. Look here and at Allan Browne's reply here