krazykasper
Registered User.
- Local time
- Today, 01:50
- Joined
- Feb 6, 2007
- Messages
- 35
I am trying to define several categories of product (Parts, Bndl, E1, Ink, and Paper). The following are fields in one of my tables: MaterialId, MaterialDesc, and ProductHierarchy.
I have the following VBA case statement that works well in my report. However, when I include two additional Select Case statements (See 2nd set of code following 1st set) it compiles without errors but my report shows "#Error".
=====================================================
Public Function MyTonerCategory()
Dim TonerCategory As String
Select Case MaterialId
Case "4511100003", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "45111X0154"
MyTonerCategory = "Bndl"
Case "7015598"
MyTonerCategory = "E1"
Case Else
MyTonerCategory = "Parts"
End Select
End Function
======================================================
Public Function MyTonerCategory()
Dim TonerCategory As String
Select Case MaterialId
Case "4511100003", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "45111X0154"
MyTonerCategory = "Bndl"
Case "7015598"
MyTonerCategory = "E1"
Case Else
MyTonerCategory = "Parts"
End Select
Select Case ProductHierarchy
Case When Like "?8S78*"
MyTonerCategory = "Ink"
End Select
Select Case MaterialDesc
Case When Like "*BOND*" Or "BND*"
MyTonerCategory = "Paper"
End Select
End Function
=====================================================
Krazy (Bill) Kasper
I have the following VBA case statement that works well in my report. However, when I include two additional Select Case statements (See 2nd set of code following 1st set) it compiles without errors but my report shows "#Error".
=====================================================
Public Function MyTonerCategory()
Dim TonerCategory As String
Select Case MaterialId
Case "4511100003", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "45111X0154"
MyTonerCategory = "Bndl"
Case "7015598"
MyTonerCategory = "E1"
Case Else
MyTonerCategory = "Parts"
End Select
End Function
======================================================
Public Function MyTonerCategory()
Dim TonerCategory As String
Select Case MaterialId
Case "4511100003", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "45111X0154"
MyTonerCategory = "Bndl"
Case "7015598"
MyTonerCategory = "E1"
Case Else
MyTonerCategory = "Parts"
End Select
Select Case ProductHierarchy
Case When Like "?8S78*"
MyTonerCategory = "Ink"
End Select
Select Case MaterialDesc
Case When Like "*BOND*" Or "BND*"
MyTonerCategory = "Paper"
End Select
End Function
=====================================================
Krazy (Bill) Kasper