My code is pretty simple in terms of what I am doing, but I get a mismatch error despite the variable being shown to equal one of my conditions. Code is below:
The line
If ptCheck = "Soft Po" Or "Hard Po" Then
is giving me the type mismatch which I am having a hard time figuring out, because the other instace of
If ptCheck = "Ceramic" Then
Works fine, and by my estimation these two lines are doing the exact same thing. What am I missing here?
VBA Code:
Private Sub CoverBox_Change()
Dim ptCvr As Variant
Dim pkSize As Variant
Dim ptCheck As Variant
ptCheck = Left(Me.CoverBox.Value, 7)
Me.PackSizeBox.Value = ""
If Me.CoverBox.Value = "" Then
pkSize = Evaluate("=FILTER(PackSize[Pack Size],PackSize[Product ID]= """ & Me.PID.Value & ""","""")")
Me.PackSizeBox.List = pkSize
Exit Sub
End If
If Me.CoverBox.Value = "Self-Watering" Then
pkSize = Evaluate("=FILTER(SelfWaterPk[Pack Size],SelfWaterPk[Product ID]= """ & Me.PID.Value & ""","""")")
Me.PackSizeBox.List = pkSize
Exit Sub
End If
If ptCheck = "Ceramic" Then
pkSize = Evaluate("=FILTER(CeramicPk[Pack Size],CeramicPk[Product ID]= """ & Me.PID.Value & ""","""")")
Me.PackSizeBox.List = pkSize
Exit Sub
End If
If ptCheck = "Soft Po" Or "Hard Po" Then
pkSize = Evaluate("=FILTER(HrdSftCover[Pack Size],HrdSftCover[Product ID]= """ & Me.PID.Value & ""","""")")
Me.PackSizeBox.List = pkSize
Exit Sub
End If
If Me.CoverBox.Value = "Tea Collection" Then
pkSize = Evaluate("=FILTER(TeaPk[Pack Size],TeaPk[Product ID]= """ & Me.PID.Value & ""","""")")
Me.PackSizeBox.List = pkSize
Exit Sub
End If
End Sub
The line
If ptCheck = "Soft Po" Or "Hard Po" Then
is giving me the type mismatch which I am having a hard time figuring out, because the other instace of
If ptCheck = "Ceramic" Then
Works fine, and by my estimation these two lines are doing the exact same thing. What am I missing here?