Having Problem with Select Case

  • Thread starter Thread starter haroldj
  • Start date Start date
H

haroldj

Hi -- This is my situation: I have a list box from which users can
choose the report that they want to print. The code works just fine
when I use an "If-Then-Else" construct but not so when it is
transferred to "Select Case". Here is a snippet from both:

If lstStores.ListIndex = 0 Then
stFullName = "I:\Ops\Grocery Rescue\Jet
Reports\Rosauers\Rosa01\Rosa01.xls"
ElseIf lstStores.ListIndex = 1 Then
stFullName = "I:\Ops\Grocery Rescue\Jet
Reports\Rosauers\Rosa02\Rosa02.xls"
ElseIf lstStores.ListIndex = 2 Then
stFullName = "I:\Ops\Grocery Rescue\Jet
Reports\Rosauers\Rosa03\Rosa03.xls"
etc.

Select Case stFullName
lstStores.ListIndex = 0: stFullName = "I:\Ops\Grocery
Rescue\Jet Reports\Rosauers\Rosa01\Rosa01.xls"
lstStores.ListIndex = 1: stFullName = "I:\Ops\Grocery
Rescue\Jet Reports\Rosauers\Rosa02\Rosa02.xls"
etc..

Also, I've tried this with the Value property as well as the ListIndex
property of the ListBox object and the results are the same.
 
The syntax should be

Select Case lstStores.ListIndex
Case 0: stFullName = "I:\Ops\Grocery Rescue\Jet
Reports\Rosauers\Rosa01\Rosa01.xls"
Case 1: stFullName = "I:\Ops\Grocery Rescue\Jet
Reports\Rosauers\Rosa02\Rosa02.xls"
etc..
End Select


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

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