Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop-down argument lists

Status
Not open for further replies.

spiralmind

Technical User
Aug 20, 2002
130
US
is there any (hopefully simple) way to create a drop-down list of values that can be selected to pass as an argument to a function? vba itself has several built-in objects and functions offering this sort of selection and auto-completion functionality, i and i'm wondering if i could implement it in my own custom functions as well.
 
Use the Listbox control. You can populate it several ways but if your arguments are few and fixed then you can type them into the ListBox's property sheet as a list with each item separated by a semi-colon.

Alternatively create a table with a single field to store the arguments and then use the ToolBox Wizard to create a Listbox based on the table. That way you can add new arguments without putting the form into design view.

You should read the help files on Listbox and ComboBox controls.
 
my intent lies more in providing this sort of selection functionality within the VBA IDE - with the intent of facilitating the code maintainence of my application with a minimal learning curve for the end users (who wish to eventually support these tools themselves, despite minimal programming experience). beleiving that the best way to make such a plan possible is to create as intuitive a back end as possible (in case they wish to add some new functionality or encounter problems in some future upgrade of access or change of third party software or operating systems) i would like for all possible options to be immediately visible when they are working with the functions i have created.
as for listboxes and comboboxes, they - as far as i know - only work on forms and wouldn't allow for the flexibility of implementation that the users of my products would like for me to provide. aside from that point, i have used such form-based interfaces for many tasks that do use the same code on different data or to generate different forms of output, and have found such systems to work very well for maximizing the front-end flexibility while concealing and protecting the inner workings of the database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top