I could use some help with this function I am trying to make work in MS Access.
I need to test two conditions (total revenue) and (product line type) and assign an Account class based on the values in these two fields.
Here is how I wrote the funtion but when I put it in my query grid it says it can compile... Any help would truly be appreciated.
Function Class(TotRev As inter, prodLine As String)
Dim Class As String
If [TotRev] < 0 And [TotRev] > 49999 And [prodLine] = "International" Then
Class = "E"
If [TotRev] < 50000 And [TotRev] > 99999 And [prodLine] = "International" Then
Class = "D"
If [TotRev] < 100000 And [TotRev] > 249999 And [prodLine] = "International" Then
Class = "C"
If [TotRev] < 250000 And [TotRev] > 499999 And [prodLine] = "International" Then
Class = "B"
If [TotRev] < 500000 And [prodLine] = "International" Then
Class = "A"
End If
Class = Null
End Function
===========================
in my query grid I am calling the function this way;
Classification: class([net revenue],[product line name])
Pleae tell me where I am falling short here - this is actually my first function that I am writing - normally I copy and edit existing ones.
Thanks,
Penn
I need to test two conditions (total revenue) and (product line type) and assign an Account class based on the values in these two fields.
Here is how I wrote the funtion but when I put it in my query grid it says it can compile... Any help would truly be appreciated.
Function Class(TotRev As inter, prodLine As String)
Dim Class As String
If [TotRev] < 0 And [TotRev] > 49999 And [prodLine] = "International" Then
Class = "E"
If [TotRev] < 50000 And [TotRev] > 99999 And [prodLine] = "International" Then
Class = "D"
If [TotRev] < 100000 And [TotRev] > 249999 And [prodLine] = "International" Then
Class = "C"
If [TotRev] < 250000 And [TotRev] > 499999 And [prodLine] = "International" Then
Class = "B"
If [TotRev] < 500000 And [prodLine] = "International" Then
Class = "A"
End If
Class = Null
End Function
===========================
in my query grid I am calling the function this way;
Classification: class([net revenue],[product line name])
Pleae tell me where I am falling short here - this is actually my first function that I am writing - normally I copy and edit existing ones.
Thanks,
Penn