Solved How to dropdown a Combo Box on form Load/Open Event? (1 Viewer)

prabha_friend

Prabhakaran Karuppaih
Local time
Today, 17:59
Joined
Mar 22, 2009
Messages
882
I tried. Not working :cry:
 
Nope. Not working
 
So in the immortal words of a million responders, What have you tried?
We aren't mind readers (not yet anyway).
 
You might want to actually post your code. Or are we supposed to guess?
 
Item Name Combo Box.jpg

When the user opens the form for the first time, the combo box is not dropped-down. The problem arises If Item_Type frame is Dead Stock and the user wants to list the Deadstocks in the combo. What to do?
 
Code:
Private Sub Frame86_AfterUpdate()
Me.ID.Requery
Me.ID.SetFocus
Me.ID.Dropdown
End Sub
Private Sub ID_DblClick(Cancel As Integer)
Call DoCmd.OpenForm("Items", acNormal, , , acFormAdd, acDialog)
End Sub
 
Well, your code is in the AfterUpdate event of the frame control, nothing to do with form Open or Load?

And ID is a terrible name for a combo box of any description!
 
Code:
Private Sub Form_Load()
Me.ID.SetFocus
Me.ID.Dropdown
End Sub

This code works only on "F8"
 
On form load does the combo list have any records?
I've no idea what F8 has to do with it.

Move the code to the current event as suggested earlier, it may be that you don't have any data before that fires.
 
On form load does the combo list have any records? - Yes it Does. (Having Both "Consumables" and "Deadstock")
I've no idea what F8 has to do with it. - (While I debug the ID.Dropdown works but after running the ID.Dropdown. The Dropdown rolls back mysteriously).
 
Code:
Private Sub Form_Load()
Me.ID.SetFocus
Me.ID.Dropdown
End Sub

This code works only on "F8"
You must give the form time to finish loading.

Code:
Private Sub Form_Load()
     Me.TimerInterval = 1
End Sub

Private Sub Form_Timer()
     Me.TimerInterval = 0
     Me.ID.SetFocus
     Me.ID.Dropdown
End Sub
 
If choosing an option in an option group is supposed to control the contents of a combo, then have the RowSource query of the combo reference the option group:

Where MyType = Forms!MyForm!MyOptionGroup

Then in the AfterUpdate event of the option group, you can requery the combo.

The Load event is way too early to do this especially since the form allows scrolling. What happens if you move to a different record?
 

Users who are viewing this thread

Back
Top Bottom