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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you let user select from list of options without using a form? 1

Status
Not open for further replies.

hazlehurstga

Programmer
Sep 4, 2003
19
0
0
US
Hi,
I need to get input from a user by providing him with a list of options to choose from, and in the same fashion as the comboxbox feature provides. Is it possible to do this without using a form? Will the InputBox function allow work? Thanks.
 
Hi

Input box is too simple to give you the list you say you want, you cannot have controls 'floating' around, they must be contained within a Container Object (eg Form, or Report etc), what is the problem with having a form?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
You could use an inputbox and check the input the user makes using an if statement. IF the user does not input one of your options you could throw a message box back saying that they must enter an option from a list you give them.

Something like

poss_options = "OPTION1" & vbCrLf & "OPTION2" etc
k=1
'then

Do While k = 1
chosen_option = InputBox(Prompt:="Choose one of the following options" & vbCrLf & poss_options)

If chosen_option = OPTION1 Then

Do what ever you want when that is choosen
Exit Do
ElseIf .... Then
.....

Else

k = MsgBox(Prompt:="Enter a proper option", Buttons:=vbOkOnly)

Loop

This will ask the user to input an option in an InputBox from a list you specify and also checks that they don't enter anything you don't want.

dyarwood
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top