Case Select statement not working (1 Viewer)

sarahb845

Registered User.
Local time
Yesterday, 16:54
Joined
Jun 19, 2002
Messages
43
I am not sure what I am doing wrong here. The [lstReports] is a listbox on my form (string values). The value chosen is a name of a report, which could be "Employee Roster", "Performance Management Detail", or others. When I select Performance Management Detail report in my listbox, the code jumps to CASE ELSE, instead of my 2nd case option. What's wrong??

-----

Private Sub cmdPreview_Click()
'Preview Report
Dim ChosenReport As String

ChosenReport = Me.lstReports

Select Case ChosenReport

Case "Employee Roster"
DoCmd.SetWarnings False
DoCmd.OpenQuery "C3qmktbl_LastandPriorTransInfo", acNormal, acEdit
DoCmd.OpenQuery "C4qupd_VarianceCal", acNormal, acEdit
DoCmd.OpenReport "rptEmployeeRoster", acPreview, "", ""
DoCmd.SetWarnings True

Case "Performance Management Detail"
Call PerfMgmtDetailReport

Case Else
DoCmd.OpenReport ChosenReport, acPreview

End Select
 

TreeFrog

New member
Local time
Today, 00:54
Joined
May 21, 2002
Messages
5
It sounds like the value in the listbox is not correct or the value in your case select maybe spelled wrong.

What is the value of ChosenReport when you step thru the code?

Also make sure your bound column is on the value that you want picked.

Hope this helps.

Treefrog
 

Users who are viewing this thread

Top Bottom