View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default CommandButtons and OptionButtons on Userform

Hello

I am having trouble with a Select Case Statement. I have about 6 reports
that I would like one command button to preveiw based on which Optionbutton
is
Selected. This is a code that I use in Access but not having any luck in
excel
can someone tell if this can been done and how

Thanks



Private Sub cmdPrint_Click()

Dim strWhere As String

'strWhere = (DatePicker?)
On Error GoTo PrintPreviewError
Select Case Me.ReportsGroup

Case 1
DoCmd.OpenReport "Payroll-Full Time", acViewPreview, , strWhere
DoCmd.Maximize
Case 2
DoCmd.OpenReport "Payroll-Part-time", acViewPreview, , strWhere
DoCmd.Maximize

Case Else
MsgBox "Select A Report!!!!!!!"
End Select

PPNormalExit:
Exit Sub

PrintPreviewError:

Resume PPNormalExit
Exit Sub

End Sub