这不适用于每个“事件”,因此最好的做法是将此代码放入任何按钮中,以便打开任何形式的ServerFilter属性卡住或每次都复制相同的记录。再次,将此代码插入到打开带有问题的表单的按钮中,并在“OpenForm”函数调用您需要的表单之前执行该操作:'关闭提供的表单。以防万一它打开DoCmd.Close acForm,“订单”'重新打开提供的表单,但在设计视图。 DoCmd.OpenForm “订单”,acDesign
Public Sub Whatever()
On Error GoTo LiveError
'Set all filters to ""
Forms![Orders].Filter = ""
Forms![Orders].ServerFilter = ""
'Save the form in design view
DoCmd.Save acForm, "Orders"
'Close the supplied Form.
DoCmd.Close acForm, "Orders"
'This is where your Open Form function would go, to open whatever form you need
'as usual. The only difference now is that all pre-saved filters will be gone
'before you apply the new filter.
Exit Sub
LiveError:
'This is so that when it goes live it doesn't error out since it can't open
'in design mode on the live server.
'Continue opening whatever form you planned on before. For example:
Call OpenOrderForm(Forms![FORMNAME]![FILTERCRITERIA])
End Sub