View Full Version : dropdown combo boxes


stalw
11-04-2001, 10:38 PM
hi
i use drop down combo boxes on a form with lots of combo box controls. this involves writing code for each combo box so that when it gets the focus , it drops down automatically using the .dropdown function.
Is there a smarter way of doing this using either a user defined function say at module level ?
Thanks

Fornatian
11-05-2001, 07:07 AM
The only way I can see is to add the below in standard module:

Public Function DropIt()
CodeContextObject.ActiveControl.Dropdown
End Function

Note: you must define it as a function to do the next bit.

Now, under the event procedure tab, on the GotFocus line type WITH the brackets.

=DropIt()

(This should be typed where it usually says [Event Procedure] if you have coding.

However I'd suggest some sort of trapping because it will get very annoying if you dont want the box to drop.

You can call the function in VBA in the same way you would call any other function

DropIt


HTH

Ian

stalw
11-05-2001, 11:04 PM
thanks ian
i will give it a try
i have been trying to sort this for a long time
sumedh