更改表单过滤器时访问崩溃 [英] access crash when changing form filter

查看:46
本文介绍了更改表单过滤器时访问崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的表格.

如果执行以下步骤,访问将始终崩溃:

Access always crash if I do these steps:

  1. 搜索2012年
  2. 然后搜索提案编号12-100(存在)

无论如何,如果我进行年份搜索,则搜索提案编号,反之亦然.它会崩溃.崩溃,我的意思是访问停止工作,必须重新启动.

No matter what, if I do the year search then the search for the proposal number or vice versa. it will crash. By crash,I mean access stop working and has to restart.

如果我在做第二个表单之前先关闭表单,它们都可以工作.

They both work if I close the form before to do the second one.

这是我的查找并清除"按钮的代码(这几乎是我表单的所有代码).

Here's the code for my find and clear button (That's almost all the code of my form).

 Private Sub btnFind_Click()
    If (Not IsNull(txtResearch) And txtResearch <> "") Then
        Me.Filter = "ProposalNo = '" & txtResearch & "'"
        Me.FilterOn = True
    ElseIf (Not IsNull(txtYear) And txtYear <> "") Then
        Me.Filter = "pyear = " & txtYear
        Me.FilterOn = True
    Else
        Me.Filter = ""
        Me.FilterOn = False
    End If

End Sub



Private Sub btnClear_Click()
    txtResearch = ""
    txtYear = ""
    Me.Filter = ""
    Me.FilterOn = False
End Sub

问题是我设置过滤器的方式吗?我不确定Me.FilterOn

The problem is it the way I set the filter? I wasn't sure about Me.FilterOn

此外,我确实尝试过压紧和修复,但是没有运气

Also, I did try to compact and repair but no luck

谢谢

推荐答案

显然,过滤器和SQL Server可能存在一些问题,但是我对此事还不够了解.您可能还想在这里查看Allen Browne的注释:

Apparently there may be a bit of a problem with filters and SQL Server, but I am not well enough up on the subject. You might also like to look at Allen Browne's notes here: http://www.pcreview.co.uk/forums/access-crashes-remove-filter-sub-form-t2772609.html

您可能希望考虑使用where语句而不是使用过滤器来设置记录源.

You may wish to consider setting the recordsource with a where statement rather than using filters.

这篇关于更改表单过滤器时访问崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆