• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Open DropDown On Entry...

MainForm / Subform... SubForm is displayed in a tab control. When the tab is selected I want the dropdown to be open. I can't get this to work. The most recent suggestion that I have been given is:
    Me![sbfFundReturnsNetListing].Form![FundNameCombo].SetFocus
    SendKeys "{F4}"

This doesn't seem to be working either. This was placed in the onclick of the tab and the onload of the main form.
0
ronallard
Asked:
ronallard
  • 5
  • 4
  • 3
1 Solution
 
brewdogCommented:
Well, I just tried this:

    Me!sbfFundReturnsNetListing.Form!FundNameCombo.SetFocus
    Me!sbfFundReturnsNetListing.Form!FundNameCombo.Dropdown

and it seems to work, though I couldn't duplicate your situation exactly. Let me know what happens . . .

brewdog
0
 
fedsunsCommented:
Ron,
      The click event for the tab control doesn't fire when you click on a tab that has a name so maybe your code didn't get executed? Anyway what I did was to put your set focus statement in the tab change event and then
in the got focus event for the combo box fundNameCombo inserted this code:
Me.FundNameCombo.Dropdown. Hope this helps please let me know how it all worked out
John Smith
0
 
ronallardAuthor Commented:
brewdog:
That is how I normally do it. But I am usually not dealing with sub-forms on pages within a tab control.

fedsuns:
I put this in the on change for the tab control:
Private Sub TabCtl0_Change()
    Me![sbfFundReturnsNetListing].Form![FundNameCombo].SetFocus
End Sub
(this code does get executed)


Then I put this in the got focus of the combo-box in the sub-form:
Private Sub FundNameCombo_GotFocus()
    Me![FundNameCombo].Dropdown
End Sub
(I put a stop in here and it never gets taken - even when I click in the  combo-box????!!)

Still not working??

Remember, MainForm has a tab control on it. On tab-6 there is a sub-form. The combo-box is actually on the sub-form.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
brewdogCommented:
Hmm, mine worked, but I attached it to form_load, not a tab form's change event. I'll test that piece tomorrow morning if this isn't solved yet.
0
 
fedsunsCommented:
Ron,
Sorry on mine it worked the first time and I quit. BAsically if the combo box all ready has focus for some reason (i.e. it is the first control in the tab order) when the set focus is executed then the got focus doesn't execute. Try this on the tab   change event:
Private Sub TabCtl0_Change()
    Me![sbfFundReturnsNetListing].Form![FundNameCombo].SetFocus
    Me![sbfFundReturnsNetListing].Form![FundNameCombo].Dropdown
End Sub
It works on my machine.
0
 
brewdogCommented:
any news here, ronallard? I have never gotten back to this issue. If you still want me to look into it further, let me know . . .
0
 
ronallardAuthor Commented:
Sorry - I've been very sick and haven't worked on this. Just got back to work today... Still would like an answer...
0
 
brewdogCommented:
I'll see if I can scrounge a few minutes later today or tomorrow morning . . .
0
 
fedsunsCommented:
Ronallard,
    Sorry you've been sick. Did the code I suggested work? If it didn't or there is a better solution please let me know. thanks
John Smith
0
 
brewdogCommented:
ronallard:

Hmm . . . I think I just duplicated your situation, and it works fine for me. Here's what I put on the Change event of my Tab Control:

    If TabCtl9.Value = 0 Then
        Me!fsubtblCheeze2.Form!cboCheeze.SetFocus
        Me!fsubtblCheeze2.Form!cboCheeze.Dropdown
    End If

where 0 is the first page in the tab control, fsubtblCheeze2 is the name of the subform control, and cboCheeze is the combo box.
0
 
ronallardAuthor Commented:
My appologies to all of you for letting this run out sooooo long. With family illnesses and deadlines at work I just haven't had a chance to follow up.

John, you solution worked just fine. It even works when just clicking on the tabs and not following the programmed progression.

Thanks again to all for you patients!
0
 
fedsunsCommented:
Your welcome and good luck
John
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now