Hello!
Hopefully this should be a very easy one to solve. I'm trying to do an If code to open a form or report, depending what option has been selected in a combo box on a modal dialogue box. I am putting the VBA on a button that say's go, so they select their report, hit Go, and I want it to then open up the report for them. However I'm getting an error that says 'Compile Error - Else without If', I'm not sure what is wrong with my If Statement (I've used them successfully elsewhere to display checklists for example depending on what is selected in a combo box).
Private Sub Command1_Click()
If Me.ReportCombo = "Team Daily Task List" Then DoCmd.OpenReport "Daily To Do List"
ElseIf Me.ReportCombo = "Team Current Active Cases" Then DoCmd.OpenReport "Current Active Cases Team"
ElseIf Me.ReportCombo = "HD Active Cases" Then DoCmd.OpenReport "HD Active Cases"
ElseIf Me.ReportCombo = "Monthly Broker Case Allocation" Then DoCmd.OpenReport "Monthly Broker Case Allocation"
ElseIf Me.ReportCombo = "Monthly Team EOI Referrals" Then DoCmd.OpenReport "Monthly EOI Referrals"
ElseIf Me.ReportCombo = "Monthly Team Full Tender Referrals" Then DoCmd.OpenReport "Monthly Full Tender Referrals"
ElseIf Me.ReportCombo = "Monthly All Tendered Case Referrals" Then DoCmd.OpenReport "Monthly Tendered Case Referrals"
ElseIf Me.ReportCombo = "Test of Change" Then DoCmd.OpenReport "Test of Change Data"
ElseIf Me.ReportCombo = "Team Weekly Task Last" Then DoCmd.OpenReport "Weekly To Do List"
ElseIf Me.ReportCombo = "Broker Case Close Details" Then DoCmd.OpenForm "Broker Case Closure Details"
ElseIf Me.ReportCombo = "CCG EOI Completed Cases" Then DoCmd.OpenReport "Broker CCG EOI Completed Cases"
ElseIf Me.ReportCombo = "CCG Completed Full Tenders" Then DoCmd.OpenReport "Broker CCG Full tender Completed Cases"
ElseIf Me.ReportCombo = "DCC EOI Completed Cases" Then DoCmd.OpenReport "Broker DCC EOI Tender Completed Cases"
ElseIf Me.ReportCombo = "DCC Completed Full Tenders" Then DoCmd.OpenReport "Broker DCC Full Tender Completed Cases"
End If
End Sub
Hopefully it's something super simple that I've missed and I'll be able to know for next time.
Thank you!
Hopefully this should be a very easy one to solve. I'm trying to do an If code to open a form or report, depending what option has been selected in a combo box on a modal dialogue box. I am putting the VBA on a button that say's go, so they select their report, hit Go, and I want it to then open up the report for them. However I'm getting an error that says 'Compile Error - Else without If', I'm not sure what is wrong with my If Statement (I've used them successfully elsewhere to display checklists for example depending on what is selected in a combo box).
Private Sub Command1_Click()
If Me.ReportCombo = "Team Daily Task List" Then DoCmd.OpenReport "Daily To Do List"
ElseIf Me.ReportCombo = "Team Current Active Cases" Then DoCmd.OpenReport "Current Active Cases Team"
ElseIf Me.ReportCombo = "HD Active Cases" Then DoCmd.OpenReport "HD Active Cases"
ElseIf Me.ReportCombo = "Monthly Broker Case Allocation" Then DoCmd.OpenReport "Monthly Broker Case Allocation"
ElseIf Me.ReportCombo = "Monthly Team EOI Referrals" Then DoCmd.OpenReport "Monthly EOI Referrals"
ElseIf Me.ReportCombo = "Monthly Team Full Tender Referrals" Then DoCmd.OpenReport "Monthly Full Tender Referrals"
ElseIf Me.ReportCombo = "Monthly All Tendered Case Referrals" Then DoCmd.OpenReport "Monthly Tendered Case Referrals"
ElseIf Me.ReportCombo = "Test of Change" Then DoCmd.OpenReport "Test of Change Data"
ElseIf Me.ReportCombo = "Team Weekly Task Last" Then DoCmd.OpenReport "Weekly To Do List"
ElseIf Me.ReportCombo = "Broker Case Close Details" Then DoCmd.OpenForm "Broker Case Closure Details"
ElseIf Me.ReportCombo = "CCG EOI Completed Cases" Then DoCmd.OpenReport "Broker CCG EOI Completed Cases"
ElseIf Me.ReportCombo = "CCG Completed Full Tenders" Then DoCmd.OpenReport "Broker CCG Full tender Completed Cases"
ElseIf Me.ReportCombo = "DCC EOI Completed Cases" Then DoCmd.OpenReport "Broker DCC EOI Tender Completed Cases"
ElseIf Me.ReportCombo = "DCC Completed Full Tenders" Then DoCmd.OpenReport "Broker DCC Full Tender Completed Cases"
End If
End Sub
Hopefully it's something super simple that I've missed and I'll be able to know for next time.
Thank you!