Hi all,
Having searched Google for hours to no avail, I have decided to post a thread.
Goal: Have the first control, which is a combobox, expand dropdown menu when the form is open.
Form Settings:
- Data Entry: Yes
- Cycle: Current Record
The code I have is as follows:
Of course the MsgBox commands are for troubleshooting and will be removed at the end. This code works fine when I manually set the focus to txtBrandName control by mouseclick or tab cycle. However, it seems to cancel out when the form is first opened. The following is what happens specifically:Code:Private Sub txtBrandName_GotFocus() MsgBox "txtBrandName GotFocus Start" Me.txtBrandName.Dropdown MsgBox "txtBrandName Got Focus End" End Sub
- Doubleclick the form from Access's Navigation sidebar
- Form is not yet visible
- "txtBrandName GotFocus Start" prompts
- Hit Ok
- Only Combobox expansion is visible (in other words, .Dropdown runs)
- "txtBrandName GotFocus End" prompts
- Hit Ok
- Combobox expansion disappears and Form is visible at the same time
So on initial opening of the form, GotFocus and all the code runs, however it doesn't seem to keep. I don't know if there is another event that runs after the first control GotFocus fires, but maybe that's screwing it up?
This is not critical to the function of my database, but this simple code has become an obsession after hours and hours of research and trial-and-error coding.
For my sanity, I would appreciate any kind of help.