Results 1 to 6 of 6
  1. #1
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172

    Drop Down List

    I have a form with a button and a combo box [cbChoices]. Clicking the button moves focus to the combo box [cbChoices]. On got focus opens the drop down list

    Private Sub cbChoices_GotFocus()
    Me.cbChoices.Dropdown
    End Sub

    The next sub moves focus to another control, changes the look up values for [], then moves back to it. It does not drop down. The list is there if I click on the little arrow. I would like it to drop down, if possible.


    Sub subLookupSelect()
    ' move off field
    DoCmd.GoToControl "tbProposalNo"
    ' move back on field so it should 'drop down' on got focus
    DoCmd.GoToControl "cbChoices" ' but it don't
    cbChoices.RowSource = "SELECT tblLookUpSelect.fTxtSelection, tblLookUpSelect.fDblOrder " _


    & "FROM tblLookUpSelect;"
    ' move back on field so it should 'drop down' on got focus
    DoCmd.GoToControl "cbChoices" ' but it don't
    ' the list is there if I click on the arrow
    End Sub

    Help would be appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Probably not how I'd do it, but have you tried adding

    Me.cbChoices.Dropdown

    to the end of the sub?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172
    I have and it does not drop down!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I'm not on a computer right now, so can't test. I'll try later, perhaps you can attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I'm going to guess that the GoToControl method doesn't fire the GotFocus event. SetFocus has been the preferred method for setting focus to a control for a long time now - for so long that I can't be sure of my guess without testing.
    EDIT:
    I guess it does - works for me, anyway. So, in absence of knowing exactly what "but it don't" means, I don't see a requery after setting the row source. Is it that the control doesn't drop down, or that the new row source isn't taking effect? I assume the former, thus would also ask if the controls are on the same form, and that there's no sub form involved.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172
    Ok, the requery did it. It works good now. Thank you very much

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Drop down list
    By andy21 in forum Forms
    Replies: 3
    Last Post: 02-15-2014, 05:23 AM
  2. Help with drop down list
    By Wlbyfred in forum Forms
    Replies: 5
    Last Post: 05-21-2013, 10:54 AM
  3. Drop Down List
    By haazzaa in forum Forms
    Replies: 3
    Last Post: 03-19-2012, 05:17 PM
  4. Replies: 4
    Last Post: 06-16-2011, 09:30 PM
  5. drop down list
    By tceicher in forum Access
    Replies: 5
    Last Post: 08-13-2009, 05:41 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