运行时错误'2001':您取消了上一个操作。 [英] Run-time error '2001': You canceled the previous operation.

查看:89
本文介绍了运行时错误'2001':您取消了上一个操作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码(VBA Access2003)


 Private Sub CmdBtn_NumberPad_Enter_Click()
Dim FLTR As String
FLTR =""
FLTR = FLTR& "ID ='" &安培; Tbox_Number& """
Me.Form.Filter = FLTR
Me.Form.FilterOn = True
...
',Tbox_number = 1234(字符串),FLTR =" ID ='1234 '"


生成: 运行时错误"2001":您取消了之前的操作。

                  没有其他"帮助"信息。 


导致此错误的条件是什么?


 


 

解决方案

您好:


如果我正在阅读您的问题正确地说,过滤器看起来应该是这样的:


" Tbox_number =" 1234"并且ID = 332"


Tbox_number和ID必须是表格中的列。


要使用正确的引号生成上述字符串,您可以使用这样的陈述:


FLTR =" Tbox_number =" &安培; """" &安培; strToolBoxNumber& """" &安培; "AND ID =" &安培; lngNumericID


strToolBoxNumber是一个包含正确值的字符串变量,lngNumericID是您要在过滤器中使用的ID号。


问候


This code (VBA Access2003)

Private Sub CmdBtn_NumberPad_Enter_Click()
Dim FLTR As String
        FLTR = ""
        FLTR = FLTR & "ID = '" & Tbox_Number & "'"
        Me.Form.Filter = FLTR
        Me.Form.FilterOn = True
...        
 '  with Tbox_number = 1234 (string)  and  FLTR = "ID = '1234'"

Generates:  Run-time error '2001': You canceled the previous operation.
                  With no further 'help' information. 

What sort of conditions lead to this error?

 

 

解决方案

Hello:

If I'm reading your question correctly, the filter should look something like this:

"Tbox_number = "1234" And ID = 332"

Tbox_number and ID must be columns in a table.

To generate the above string with the proper quotes, you can use a statement like this:

FLTR = "Tbox_number =" & """" & strToolBoxNumber & """" & "AND ID=" & lngNumericID

strToolBoxNumber is a string variable containing the proper value and lngNumericID is the ID number you want to use in the filter.

Regards


这篇关于运行时错误'2001':您取消了上一个操作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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