Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Filter 记录复制:Access 2003,VBA。服务器过滤器卡住了_Filter_Duplicates_Records - Fatal编程技术网

Filter 记录复制:Access 2003,VBA。服务器过滤器卡住了

Filter 记录复制:Access 2003,VBA。服务器过滤器卡住了,filter,duplicates,records,Filter,Duplicates,Records,我有一个问题,我其实知道答案,但我想把它放在那里,为任何其他人谁可能与它斗争,因为我没有找到一个答案在互联网上,但拼凑起来自己。为了省去别人的麻烦。在Access 2003中,当用户每次单击不同的记录时都会得到相同的记录时,很可能是因为在设计模式下保存时,它也会将服务器筛选器属性保存到筛选到的任何记录中。然后,当你现场发送时,它就被卡住了。我将在下面提供这个问题的答案。这并不是对每个“事件”都有效,所以最好的做法是将此代码放在用于打开任何表单的按钮中,每次都会卡住它的ServerFilter属性

我有一个问题,我其实知道答案,但我想把它放在那里,为任何其他人谁可能与它斗争,因为我没有找到一个答案在互联网上,但拼凑起来自己。为了省去别人的麻烦。在Access 2003中,当用户每次单击不同的记录时都会得到相同的记录时,很可能是因为在设计模式下保存时,它也会将服务器筛选器属性保存到筛选到的任何记录中。然后,当你现场发送时,它就被卡住了。我将在下面提供这个问题的答案。

这并不是对每个“事件”都有效,所以最好的做法是将此代码放在用于打开任何表单的按钮中,每次都会卡住它的ServerFilter属性或复制同一条记录。同样,在打开有问题表单的按钮中插入此代码,并在“OpenForm”函数调用所需表单之前执行此操作:“关闭提供的表单”。以防万一它是打开的DoCmd。关闭acForm,“Orders”'重新打开提供的表单,但在设计视图中。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