Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    OnClick event not firing on combo


    I have a popup form that contains a combo box bound to a simple query as RowSource. The KeyDown event fires okay where I look for vbKeyEscape, but no response when a row item is detected. Is there something "magic" about a combo on a popup? It works if I test it on a non-popup.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Your post title says onclick; your question suggests one of the update or change events isn't working?
    when a row item is detected.
    That means "selected"?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Neither After or Change fire when an item is "selected". I'm expecting the OnClick Event to fire when I select (Detect) and item in a combo dropdown.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Combobox OnClick doesn't work the way I suspect you're expecting it to, which is "I click on it and event should run". AFAIC, it's pretty useless as it only follows the AfterUpdate event and a few others that I suspect don't apply in your case. See https://docs.microsoft.com/en-us/off...ComboBox.Click

    Note that this is a page from the entire Office vba. You'll find it very useful for questions like this and so many others.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Selects an item in a combo box or list box, either by pressing the arrow keys and then pressing the ENTER key or by clicking the mouse button.
    Not sure I described the issue very well. The issue is when the combo box is dropped down, either by code or "clicking" on the down-arrow, and displaying the RowSource data line-by-line the OnClick event doesn't fire when I detect and item with the mouse. I'm expecting my Event Procedure to receive control so that code can take the appropriate path. The combo box works perfectly if I move it to a non-popup form so hence my mystery.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    when I detect and item with the mouse
    I don't know what that means either. If it means you're selecting an item (changing the current value or not) then clicking on that value and the click even isn't firing - it's not supposed to. For me, there is no difference if the form is popup or not. It behaves as described in the link I provided. Did you read it?
    EDIT - I see that your quote comes from there. Will review.
    So now I'm wondering if what you're saying is that if you drop down the list one way or another, then keyboard arrow down/up (or perhaps select a list item via code) and keyboard press enter key, the click event doesn't fire. If that's it, I'd do something else because the Enter key is a temperamental thing to deal with. While the form keypress property has to be set to true, I don't think it makes a difference in this issue. I suspect you'd need a keypress event and trap for Enter key. Or allow the user to do what should come naturally and select from the list manually instead of making things too 'automatic'. Or maybe use Tab key instead?

    EDIT2 by any chance is the control or form in question unbound?

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    EDIT2 by any chance is the control or form in question unbound?
    The popup form itself IS NOT bound, only the combo is bound.

  8. #8
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    The popup form itself IS NOT bound, only the combo is bound.
    Bound to what? The combo has an underlying query but if it was bound, it would be bound to the form.
    Whats supposed to happen when you make a selection? Maybe you should post your code.

  9. #9
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Quote Originally Posted by GraeagleBill View Post
    The popup form itself IS NOT bound, only the combo is bound.
    AFAIK that is not possible. I've never seen a list of fields from which one can be selected to bind a control to if the form isn't bound, and if you type one in yourself it should complain.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Sorry guys, got a bit hung up in what I guess is too much of a superficial understanding in using the word "bound". I usually think of bound as referring to an object's data dependency.

    Anyway, below is a screenshot snippet of the form where one can observe the combo control hidden behind a row of three command buttons. And, below that screenshot is the code that, while I've done this sort of arrangement countless times, will not "fire" when the user selects/detects/clicks-upon one of the items displayed in the dropped-down list. Right or wrong, in my vocabulary the combo control is "bound" to the table that contains the names of archive files.

    Click image for larger version. 

Name:	004.jpg 
Views:	19 
Size:	45.5 KB 
ID:	37184

    Code:
    Private Sub cmdViewArch_Click()
    Me.cboArchView.Visible = True    'Un-hide the combo control
    Me.cboArchView.SetFocus          'Put the focus on the combo and
    Me.cboArchView.Dropdown          'Show user library of archive files
    End Sub
    
    Private Sub cboArchView_Click()
    Dim strArcFile As String
    
    strArcFile = Me.cboArchView.Column(1)  'Capture whatever file name might have been selected
    
        If MsgBox(strArcFile & vbNewLine & _
                 "archive file selected.  Do you want to simply" & vbNewLine & _
                 "view the file or restore it as primary data?", vbYesNoCancel) = vbYes Then
                   
                   'BLAH BLAH BLAH
                   
        End If
    
    Me.cmdViewArch.SetFocus
    Me.cboArchView.Visible = False
    
    End Sub
    
    Private Sub cboArchView_KeyPress(KeyAscii As Integer)
        If KeyAscii = vbKeyEscape Then
            Me.cmdViewArch.SetFocus
            Me.cboArchView.Visible = False
        End If
    End Sub

  11. #11
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    I usually think of bound as referring to an object's data dependency.
    I might have described it that way, which still makes me wonder. Put it this way: a form or report is bound to a table or query, either of which can be referred to as a domain. Thus if you said the forms domain was qryMyQuery, I'd still know what you're talking about.

    Form/report controls are bound to fields, but in order for that to happen, the form/report itself must be bound. So in one of your statements you declared that the form was NOT bound but the combo is. The first part of this paragraphs says 'no way'. I'm open to being corrected if I'm the one who's not understanding.

    The point I'm trying to arrive at is, if the combo is not bound (don't confuse that with having a row source property - we're talking about a control source property here in order to declare it as being bound) then the behaviour you're describing is normal. The OnClick event won't fire if the combo isn't bound. If you're not sure, you could post an image of the property sheet data tab for the combo so we can see the control source and row source properties.

  12. #12
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    First, I want to thank you for your extensive efforts to straighten out the "old geezer" on some important distinctions about binding. I did think that setting the RowSource of a control constituted binding.

    So, where we are now is that the form is bound to the domain represented by the query QArchives. And, that the combo is bound to the field ArchFileName within that domain. Still, the OnClick DOES NOT fire when I click/detect/select a file name from among the list of files when the combo is down.

    Below are the property sheets involved in our discussion:
    Click image for larger version. 

Name:	000.jpg 
Views:	18 
Size:	51.6 KB 
ID:	37187Click image for larger version. 

Name:	001.jpg 
Views:	19 
Size:	59.4 KB 
ID:	37188Click image for larger version. 

Name:	002.jpg 
Views:	19 
Size:	56.2 KB 
ID:	37189

  13. #13
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Well gentlemen, we seem to have been dealing with a corrupted form. I should have been suspicious of that earlier, as I've seen it in the past where forms/report and/or controls are copied, which partially was done here. To solve this caper, I created the popup form in a blank DB, tested it successfully and then basically did the same thing in the app with a new form created "from scratch".

    I did learn something about binding and binding terminology so not all was lost.

    Thanks,
    Bill

  14. #14
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    when I click/detect/select a file name from among the list of files when the combo is down
    ...and you are making this selection how? I don't see it in code, yet where else would it be if you're dropping the list down by code?

    If I .Dropdown on a combo and select an item, the onClick event runs for me.

  15. #15
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Works for me too after the form rebuild described in post #13

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Key Press Event and/or Key Up Event not firing as expected
    By GraeagleBill in forum Programming
    Replies: 7
    Last Post: 01-16-2018, 04:11 AM
  2. Combo box On Dbl-Click event not firing
    By GraeagleBill in forum Forms
    Replies: 5
    Last Post: 12-26-2016, 06:45 PM
  3. Key Down event not firing
    By GraeagleBill in forum Programming
    Replies: 4
    Last Post: 11-18-2016, 12:45 AM
  4. OnClick not firing
    By richard1941 in forum Access
    Replies: 4
    Last Post: 01-06-2015, 05:27 PM
  5. Replies: 2
    Last Post: 03-26-2014, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums