2012-04-09 55 views
0

我有一个问题,其实我知道答案,但希望把它在那里为别人谁可以与它挣扎,因为我还没有找到在互联网上的答案,但拼凑在一起,它自己。为了拯救别人的麻烦。当您的用户他们点击不同的记录,在Access 2003中每次都得到相同的记录,它是最有可能的,因为当你在设计模式保存它也保存在服务器过滤器属性到任何记录它过滤。然后,当你发送它时,它会卡住这种方式。我会在下面提供这个问题的答案。记录复制:Access 2003,VBA。服务器过滤器卡住

回答

1

这不适用于每个“事件”,因此最好的做法是将此代码放入任何按钮中,以便打开任何形式的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