Select Case from Text Box Input

  • Thread starter Thread starter mackerma
  • Start date Start date
M

mackerma

I would like to take the text from a text box in a userform and mak
that the criteria for a select case. I have tried the code

Cases = frmTestSel.txtSpec.Value 'I've also trie
frmTestSel.txtSpec.Text
Select Case IDNum
Case Cases
'Insert commands here
End Select

The code only works when the text box contains a single value. I hav
also tried using an Input Box instead of a Text Box on a form; th
results are the same--the case is never executed unless the bo
contains a single value only.

To be more detailed, I have 130+ "datasets". All the datasets ar
identified by an ID Number (IDNum). The code performs variou
operations on chosen datasets. I would like to be able to choos
datasets base on the ID Number, so that the user could compare dataset
1, 5, 13 and 120 for example. I know I could do this with a List Box
but I have 130+ choices, to this is a very non-ideal solution. An
other suggestions
 
I'd think its an impossible taske -- your user can enter a selection of
datasets, a ranf=dom selection of 1 up to 130!
You can't possibly have a case for each set.
What you could try is

dim ar
ar = split(frmTestSel.txtSpec.Text,",")
for index = lbound(ar,1) to ubound(ar,1)
call ProcessID( ar(index) )
next


.....where ProcessID does whatever it is on each dataset
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top