Results 1 to 7 of 7
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    combo box pulldown "blinks" with roquery on got focus

    behind the GotFocus event of a combo box, i have code for a a requery; however doing so creates this odd effect (which does not happen when the line of code is commented out)
    when the user first clicks the combo, the drop-down list opens, the immediately closes.
    on a second click, it behaves normally: the drop-down opens and waits for a user action.

    involved are (3) tables:
    tbeFixtureTypeDetails


    tbeSubIssueSchedule
    tbeSubIssueSchedule_Types

    the user creates a record in tbeSubIssueSchedule
    then adds to it records in the related table tbeSubIssueSchedule_Types
    entries for tbeSubIssueSchedule_Types are pulled from tbeFixtureTypeDetails

    the parent form is a single record form (data source: tbeSubIssueSchedule)
    on it is a continuous record SUBform (data source subform tbeSubIssueSchedule_Types)
    the COMBOBOX is on this sub form and is used to add records to the table tbeSubIssueSchedule_Types from tbeFixtureTypeDetails

    the intent is for the pulldown to show all records in tbeFixtureTypeDetails that are NOT already being used for the current tbeSubIssueSchedule.

    behind the combobox i have the ridiculous query (although, it does work, albeit with this strange glitch)

    Code:
    SELECT tbeFixtureTypeDetails.Type, qrySubSchedule_currentTypesUsed.type
    FROM tbeFixtureTypeDetails LEFT JOIN qrySubSchedule_currentTypesUsed ON tbeFixtureTypeDetails.Type = qrySubSchedule_currentTypesUsed.Type
    WHERE (((qrySubSchedule_currentTypesUsed.type) Is Null))
    ORDER BY TDASort_AlphaCnt([tbeFixtureTypeDetails]![type]), tbeFixtureTypeDetails.Type;
    it includes references to the query qrySubSchedule_currentTypesUsed which is

    Code:
    SELECT tbeSubIssueSchedule_Types.SubIssueTitle, tbeSubIssueSchedule_Types.type
    FROM tbeSubIssueSchedule_Types
    WHERE (((tbeSubIssueSchedule_Types.SubIssueTitle)=[forms].[frmSubIssueSchedules_Entry].[txtSubIssueTitle]));

    I think I've made this FAR more complicated than it ought to be, and I'll appreciate in advance any thoughts, suggestion, direction...

    be well, stay healthy,
    m.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,536
    Can you show us the code in the Got Focus event
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    Code:
    Private Sub cboType_GotFocus()
        Me.cboType.Requery
    End Sub

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Can you see if you still get the flicker if you use the Enter event instead?
    https://docs.microsoft.com/en-us/off...0Enter%20event.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    You can give a combo the focus by clicking on the button as well as the data portion so it's an odd one in that respect. I can imagine your problem by dropping down the list, thereby giving it the focus, causing it to requery which causes it to drop back up. On a subsequent click, it already has the focus so the requery doesn't run. If you must requery when interacting with that control, try the Enter event instead. Usually one requeries a combo based on some other action, such as choosing a value from a different combo (as in cascading combos). Maybe in your case, you could also use form's Current event, but that would cause a requery of the combo each time a new record is selected and once upon form opening.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    TOTALLY INTERESTING: this odd/unique: '... focus by clicking on the button as well.. '

    ...moving the requery to the Enter event, nor the Current was effective; BUT !!! moving it to the EXIT event did.

    thnx so much

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    I can't imagine how requerying the combo after it loses focus does anything of value, but if you're happy then I guess we are too.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-23-2020, 07:13 AM
  2. Replies: 4
    Last Post: 04-12-2019, 09:47 AM
  3. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  4. Control "what gets the focus" when a form opens?
    By GraeagleBill in forum Forms
    Replies: 3
    Last Post: 12-26-2014, 10:41 PM
  5. how to change focus of "next record" button
    By Andyatwork in forum Forms
    Replies: 2
    Last Post: 09-05-2012, 04:34 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