GordI am writing some VB code in a combo box''s ''On Click'' event on a form. Itwould appear the event fires when a selection is clicked on from theavailable drop down list. This is about what I would expect to happen andso my code runs just fine.However, if any editing is done in the box (i.e. don''t select from the listand just type my own entry, or perhaps make changes to what was selectedfrom the drop down list) and then I click on some other control on the form,then the ''On Click'' event fires for the combo box? (It looks more like a''Lost Focus'' event to me!).Is this some bug in VB or am I misunderstanding the event? I''ve gone toMicrosoft''s web for Office updates and it says everything''s up to date.Thanks,Gord 我创建了一个新表格; A97。 2控制;与价值观相结合; 1,2,3,4 和一个关闭表格的命令按钮。 如果我在两个控件之间切换并通过输入 1,2,3,4它执行点击或更新后事件,具体取决于输入的 值。与单击下拉值并选择相同。 Private Sub Combo0_AfterUpdate() 如果Me.Combo0< 3然后MsgBoxAfter Less than 3 End Sub Private Sub Combo0_Click() If Me.Combo0 2 Then MsgBox"点击大于2 结束子 我将代码更改为 Private Sub Combo0_AfterUpdate() 如果Me.Combo0< 3然后 MsgBox小于3后 否则 MsgBox大于2后 结束如果 结束Sub Private Sub Combo0_Click() 如果Me.Combo0 2那么 MsgBox" ;点击大于2 否则 MsgBox点击小于3 结束如果 结束Sub 它总是执行AfterUpdate然后执行Click事件;输入 值并通过鼠标选项卡或从下拉列表中选择值。 这是'A97帮助说的 对于控件,当用户发生此事件时: ·用鼠标左键单击控件。点击带有 的控件,鼠标右键或鼠标中键不会触发此事件。 ·用鼠标左键单击包含超链接数据的控件。 使用鼠标右键或鼠标中键单击一个控件不会触发此事件。当用户将鼠标指针移动到包含超链接数据的控件 上时,鼠标指针变为手状态。图标。 当用户点击鼠标按钮时,超链接被激活,然后 然后发生Click事件。 ·选择组合框或列表框中的项目,方法是按 箭头键,然后按ENTER键或单击鼠标按钮。 ·按空格键当命令按钮,复选框,选项按钮或 切换按钮具有焦点时。 ·在具有命令按钮的表单上按下ENTER键/> 默认属性设置为是。 ·在具有命令按钮的表单上按ESC键,其中取消 属性为设为是。 ·按下控件的访问键。例如,如果命令按钮的'/ b $ b Caption属性设置为& Go,按ALT + G会触发事件。 当我改变时价值和标签...我没有看到列为行动 将激活OnClick事件。 这是一个错误吗?我会让专家决定。I created a new form; A97. 2 Controls; Combo with with values; 1,2,3,4and a command button to close the form.If I tab between the two controls and change the value by entering1,2,3,4 it executes the click or after update event depending on thevalue entered. Same with clicking on the dropdown values and selecting.Private Sub Combo0_AfterUpdate()If Me.Combo0 < 3 Then MsgBox "After Less than 3"End SubPrivate Sub Combo0_Click()If Me.Combo0 2 Then MsgBox "Click Greater than 2"End SubI changed the code toPrivate Sub Combo0_AfterUpdate()If Me.Combo0 < 3 ThenMsgBox "After Less than 3"ElseMsgBox "After Greater than 2"End IfEnd SubPrivate Sub Combo0_Click()If Me.Combo0 2 ThenMsgBox "Click Greater than 2"ElseMsgBox "Click Less than 3"End IfEnd SubIt always executed the AfterUpdate then the Click event; by entering thevalues and tabbing or selecting the values from the dropdown via the mouse.Here''s what A97 help saysFor a control, this event occurs when the user:·Clicks a control with the left mouse button. Clicking a control withthe right or middle mouse button does not trigger this event.·Clicks a control containing hyperlink data with the left mouse button.Clicking a control with the right or middle mouse button does nottrigger this event. When the user moves the mouse pointer over a controlcontaining hyperlink data, the mouse pointer changes to a "hand" icon.When the user clicks the mouse button, the hyperlink is activated, andthen the Click event occurs.·Selects an item in a combo box or list box, either by pressing thearrow keys and then pressing the ENTER key or by clicking the mouse button.·Presses SPACEBAR when a command button, check box, option button, ortoggle button has the focus.·Presses the ENTER key on a form that has a command button whoseDefault property is set to Yes.·Presses the ESC key on a form that has a command button whose Cancelproperty is set to Yes.·Presses a control''s access key. For example, if a command button''sCaption property is set to &Go, pressing ALT+G triggers the event.When I change the value and tab...I don''t see that listed as an actionthat would activate the OnClick event.Is it a bug? I''ll let the experts decide.没有其他代码。我简化了一切以消除变量。 只需在表单上放一个组合框和一些其他控件(组合甚至不需要需要源列表)。放一个''msgbox"这个组合在组合的点击事件中执行了它的点击 事件'''。现在运行表单并在组合中键入 ,然后单击另一个控件。你会看到 我的意思。 谢谢, Gord 那么,我正在使用Access 2007. " bhicks11 via AccessMonster.com" < u44327 @ uwewrote in message news:88702e8eec2bc @ uwe ...There''s no other code. I simplified everything to eliminate variables.Just put a combo box and some other control on a form (combo doesn''t evenneed source for a list). Put a ''msgbox "This combo executed its clickevent"'' in the click event of the combo. Now run the form and typesomething into the combo, then click on the other control. You''ll see whatI mean.Thanks,GordBy the way, I''m using Access 2007."bhicks11 via AccessMonster.com" <u44327@uwewrote in messagenews:88702e8eec2bc@uwe... 这对我来说是个新人。您是否检查确定没有 其他 事件及其后面的代码?对我来说听起来像是一个LostFocus事件。 Bonnie http://www.dataplus-svc.com Gord写道:That''s a new one on me Gord. Did you check to make sure there are nootherevents with code behind them? Sounds like an LostFocus event to me also.Bonnie http://www.dataplus-svc.comGord wrote: >>我正在表单上的组合框''On Click''事件中编写一些VB代码。当从可用下拉列表中单击选择时,它将显示事件触发。这是关于我期望发生的事情和所以我的代码运行得很好。 然而,如果在框中进行任何编辑(即不要从列表然后只需输入我自己的条目,或者从下拉列表中对所选内容进行更改,然后点击表单上的其他控件, 这是VB中的一些错误还是我误解了这个事件?我已经去了微软办公室更新的网页,它说所有内容都是最新的。 谢谢, Gord>>I am writing some VB code in a combo box''s ''On Click'' event on a form. Itwould appear the event fires when a selection is clicked on from theavailable drop down list. This is about what I would expect to happen andso my code runs just fine.However, if any editing is done in the box (i.e. don''t select from thelistand just type my own entry, or perhaps make changes to what was selectedfrom the drop down list) and then I click on some other control on theform,then the ''On Click'' event fires for the combo box? (It looks more like a''Lost Focus'' event to me!).Is this some bug in VB or am I misunderstanding the event? I''ve gone toMicrosoft''s web for Office updates and it says everything''s up to date.Thanks,Gord - 通过AccessMonster.com发布消息 http://www.accessmonster.com/Uwe/For...ccess/200808/1 这篇关于这是VB中的错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-24 05:49