Run-time Error 2118 - You must save the current field before you run the Requery acti (1 Viewer)

OldBirdman

Registered User.
Local time
Yesterday, 21:27
Joined
Jul 14, 2008
Messages
15
Code:
Private Sub cboQuickList_Click()
    . . .
    Forms!fAAA.cboQuickList.Requery
    Forms!fAAA.cboQuickList.Visible = True
    Forms!fAAA.cboQuickList.Dropdown
End Sub
I am clicking the Dropdown list of a combobox. Therefore, it is visible, enabled, and after the click has the focus. The combobox is unbound, and the text portion is still empty, not used. Attempting to set the focus before the requery allows the requery, but then the set focus after the requery fails with "Run-time Error 2110 - Microsoft Access can't move the focus to the control cboQuickList."
Eliminating the second setfocus causes "Run-time Error 2185 - You can't reference a property or method for a control unless the control has the focus." with the .Dropdown statement. "SendKeys {Esc}, True" does various things, but either the errors persist, or the dropdown list does not display.
Stepping through the code is meaningless as the act of stopping the code negates the .Dropdown, and apparently affects the .SetFocus.
 

CyberLynx

Stuck On My Opinions
Local time
Yesterday, 21:27
Joined
Jan 31, 2008
Messages
585
I see that you are referencing the cboQuickList control from within the OnClick event of the cboQuickList control. Are you referencing a Combo Box of the same name on a different Form or is this in the same Form?

What exactly are you trying to do with this code?

.
 

WayneRyan

AWF VIP
Local time
Today, 05:27
Joined
Nov 19, 2002
Messages
7,122
Bird,

Just a guess as I've been drinking today ...

Code:
Private Sub cboQuickList_Click()
    Forms!fAAA.Dirty = False
    Forms!fAAA.cboQuickList.Requery
    Forms!fAAA.cboQuickList.Visible = True
    Forms!fAAA.cboQuickList.Dropdown
End Sub

Wayne
 

Users who are viewing this thread

Top Bottom