MS Access表单筛选器问题

时间:2017-08-03 17:09:58

标签: vba ms-access filter

我正在努力解决这个问题。我有一个表单,应用过滤器来过滤掉相应工程师的记录。所以,如果我把 steve ,我只会看到史蒂夫的记录。

我现在有多达938条记录,这就是我发现问题的方法。记录938来自史蒂夫,但是当我按照他的名字过滤掉表格时,我看到的记录高达836,其中一个是史蒂夫的记录,836之后史蒂夫的所有其他记录都没有显示。

这是我使用

的代码
    if Name_Filter.Value = "Steve" Then
    Me.FilterOn = True 
    RunCommand acCmdRecordsGoToLast 'Here it shoud go to record 938 but only shows up to 836'
    Lastrcrd = CurrentRecord 'Here it should make record 938 the last record, but it makes record 836 the last' end if

希望你能帮助我做错了什么。

1 个答案:

答案 0 :(得分:0)

你的代码没什么意义。它应该是:

Me.Filter = "Name_Filter = 'Steve'"
Me.FilterOn = True 

然后可能是:

If Me!Name_Filter.Value = "Steve" Then
    Me.Filter = "NameField = 'Steve'"
    Me.FilterOn = True 
Else
    Me.FilterOn = False
End If