Microsoft Access运行时错误DoCmd.GoToRecord,acNext

时间:2015-08-25 11:36:58

标签: ms-access runtime-error

为了方便用户,我一直在尝试在表单下面添加一组按钮。只有我用脚本编写的问题是我无法让下一个记录按钮工作。这里我得到一个运行时错误2105.

它假设只显示下一个现有记录,而是提供运行时错误并跳过所有其他记录并转到最后一个记录。

我做错了什么想法?

If Me.ActiveXBestEl92.Enabled = False Then
    Me.ActiveXBestEl92.Enabled = True
    End If

With Recordset
  If .AbsolutePosition = .RecordCount Then


  Me.ActiveXBestEl93.Enabled = False
      Else


DoCmd.GoToRecord , , acNext


  End If
End With

Exit_Next_Record:
    Me.ActiveXBestEl93.Enabled = False

Exit Sub

Err_Next_Record:

MsgBox Err.Description
Resume Exit_Next_Record 

提前致谢

1 个答案:

答案 0 :(得分:0)

试试这个:

With Me.RecordsetClone
    If .AbsolutePosition = .RecordCount Then
        Me!ActiveXBestEl93.Enabled = False
    Else
        .MoveNext
    End If
End With

或者这个:

With Me.RecordsetClone
    If Me.CurrentRecord = .RecordCount Then
        Me!ActiveXBestEl93.Enabled = False
    Else
        .MoveNext
    End If
End With