Good Evening!
I am trying to format a form through VBA. I am getting a compile error "Compile Error: Case without Select Case". I can't find the problem. I have pasted the code below. I am VBA Tenderfoot, so it probably is a simple mistake. Thanks for your help!
Private Sub Form_Open(Cancel As Integer)
Select Case ([Forms]![FrmTrackRptDatesODR]![RptType])
Case 1
Me.RADue.Visible = True
Me.RAProj.Visible = True
Me.RAComp.Visible = True
If Me.RADue < Date + 30 Then
'Make control background Opaque.
Me.RADue.BackStyle = 1
'Make control back color Yellow.
Me.RADue.BackColor = vbYellow
Else
'Make control background transparent.
Me.RADue.BackStyle = 1
'Make background color red.
If Me.RADue <= Date + 30 Then
Me.RADue.BackColor = vbRed
End If
Case 2
Me.CSPDue.Visible = True
Me.CSPProj.Visible = True
Me.CSPComp.Visible = True
If Me.CSPEFF < Date + 30 Then
'Make control background Opaque.
Me.CSPDue.BackStyle = 1
'Make control back color Yellow.
Me.CSPDue.BackColor = vbYellow
Else
'Make control background transparent.
Me.CSPEFF.BackStyle = 1
'Make background color red.
If Me.CSPEFF <= Date + 30 Then
Me.CSPDue.BackColor = vbRed
End If
Case 3
Me.RAADue.Visible = True
Me.RAAProj.Visible = True
Me.RAAComp.Visible = True
If Me.RAAEXP < Date + 30 Then
'Make control background Opaque.
Me.RAADue.BackStyle = 1
'Make control back color Yellow.
Me.RAADue.BackColor = vbYellow
Else
'Make control background transparent.
Me.RAADue.BackStyle = 1
'Make background color red.
If Me.RAAEXP <= Date + 30 Then
Me.RAADue.BackColor = vbRed
End If
End Select
End Sub
I am trying to format a form through VBA. I am getting a compile error "Compile Error: Case without Select Case". I can't find the problem. I have pasted the code below. I am VBA Tenderfoot, so it probably is a simple mistake. Thanks for your help!
Private Sub Form_Open(Cancel As Integer)
Select Case ([Forms]![FrmTrackRptDatesODR]![RptType])
Case 1
Me.RADue.Visible = True
Me.RAProj.Visible = True
Me.RAComp.Visible = True
If Me.RADue < Date + 30 Then
'Make control background Opaque.
Me.RADue.BackStyle = 1
'Make control back color Yellow.
Me.RADue.BackColor = vbYellow
Else
'Make control background transparent.
Me.RADue.BackStyle = 1
'Make background color red.
If Me.RADue <= Date + 30 Then
Me.RADue.BackColor = vbRed
End If
Case 2
Me.CSPDue.Visible = True
Me.CSPProj.Visible = True
Me.CSPComp.Visible = True
If Me.CSPEFF < Date + 30 Then
'Make control background Opaque.
Me.CSPDue.BackStyle = 1
'Make control back color Yellow.
Me.CSPDue.BackColor = vbYellow
Else
'Make control background transparent.
Me.CSPEFF.BackStyle = 1
'Make background color red.
If Me.CSPEFF <= Date + 30 Then
Me.CSPDue.BackColor = vbRed
End If
Case 3
Me.RAADue.Visible = True
Me.RAAProj.Visible = True
Me.RAAComp.Visible = True
If Me.RAAEXP < Date + 30 Then
'Make control background Opaque.
Me.RAADue.BackStyle = 1
'Make control back color Yellow.
Me.RAADue.BackColor = vbYellow
Else
'Make control background transparent.
Me.RAADue.BackStyle = 1
'Make background color red.
If Me.RAAEXP <= Date + 30 Then
Me.RAADue.BackColor = vbRed
End If
End Select
End Sub