Solved How to dropdown a Combo Box on form Load/Open Event?

prabha_friend

Prabhakaran Karuppaih
Local time
Today, 13:39
Joined
Mar 22, 2009
Messages
1,037
I tried. Not working :cry:
 
So in the immortal words of a million responders, What have you tried?
We aren't mind readers (not yet anyway).
 
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
 

Users who are viewing this thread

Back
Top Bottom