单击ListBox执行错误的代码。 [英] Click ListBox executes the wrong code.

查看:95
本文介绍了单击ListBox执行错误的代码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个ListBox,ColumnCount = 1,其中lbxAlpha1.RowSource =" A" ;;" C";" E" ;; 。 。 。和lbxAlpha2.RowSource =" B";D;F; 。 。 。只要我只使用其中一个ListBox,一切正常。当我使用一个,然后单击另一个时,我得到运行时错误''94'',ListBox的值为Null。


错误发生在WRONG ListBox的Call NewLetter()上(参见下面的代码)。


我跳过了Call语句,使用''Step Into'确定表单/单击调用_click过程,而不是代码中的其他位置。


如果我通过删除lbxAlpha1&删除另一个盒子的空白2个语句,然后两个ListBox都在错误点具有Null值,即使每个ListBox中的表单上突出显示正确的字母。


找到''lbxAlpha'的整个项目'除了在Form_Load中初始化之外没有找到任何其他的出现。


有什么建议吗?


Windows XP& Access 2002


Private Sub lbxAlpha1_Click()

lbxAlpha2 =""

调用NewLetter(lbxAlpha1)

End Sub''lbxAlpha1_Click

Private Sub lbxAlpha2_Click()

lbxAlpha1 =""

调用NewLetter(lbxAlpha2)

结束子''lbxAlpha2_Click


从表格中,我点击lbxAlpha1 = A,然后点击C,然后是E,然后是F,然后出现错误@Call NewLetter(lbxAlpha1) )在Sub lbxAlpha1_Click()中,但我应该在Sub lbxAlpha2_Click()

解决方案

列表框的控件源是否绑定到任何东西?


Mary



列表框的控件源是否绑定到任何内容?


Mary



否,两者都是Unbound,Enabled = True,Visible = True,Locked = False,RowSourceType = Value List


展开 | 选择 | Wrap | 行号

I have 2 ListBoxes, ColumnCount=1 with lbxAlpha1.RowSource = "A";"C";"E"; . . . and lbxAlpha2.RowSource = "B";"D";"F"; . . . All works fine as long as I only use one of the ListBoxes. When I have used one, and click the other, I get run-time error ''94'', and the value for the ListBox is Null.

The error occurs at the Call NewLetter() for the WRONG ListBox (See Code Below).

I have skipped the Call statement and with ''Step Into'' determined that the form/click called the _click procedure, not elsewhere in the code.

If I remove the clearing of the other box by removing the lbxAlpha1 & 2 statements, then both ListBoxes have Null values at the point of error, even though the correct letter is highlighted on the form in each ListBox.

Find for entire project for ''lbxAlpha'' does not find any other occurrances except initialization in Form_Load.

Any suggestions?

Windows XP & Access 2002

Private Sub lbxAlpha1_Click()
lbxAlpha2 = ""
Call NewLetter(lbxAlpha1)
End Sub ''lbxAlpha1_Click
Private Sub lbxAlpha2_Click()
lbxAlpha1 = ""
Call NewLetter(lbxAlpha2)
End Sub ''lbxAlpha2_Click

From the form, I click lbxAlpha1=A, then C, then E, then F and error occurs @Call NewLetter(lbxAlpha1) in Sub lbxAlpha1_Click(), but I should be in Sub lbxAlpha2_Click()

解决方案

Is the control source of the listboxes bound to anything?

Mary


Is the control source of the listboxes bound to anything?

Mary

No, both are Unbound, Enabled=True, Visible=True, Locked=False, RowSourceType=Value List


Expand|Select|Wrap|Line Numbers


这篇关于单击ListBox执行错误的代码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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