Question : run time error: you entered an expression that has no value

Not sure what this error means or how to correct it. i am calling a function that is acting as a link between my query and my class object.
called by:
DateRank: CreateTestClass(nz([build_from],"01/01/1900"),nz([forms]![main]![INTRODATE].[Value],"01/01/1900"),"Date",nz([build_to],"7000"),nz([forms]![main]![TERMINATIONDATE].[Value],"1/1/1900"))

it only fails on the "date" part all the other calls are working fine.

I believe i have handled the nulls correctly with the nz.

The daterank function itself is stripped bare for testing until i can find whats going wrong.
 
error example
331077
 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
Public Function CreateTestClass(ClientValueIn As Variant, CWValueIn As Variant, test As String, Optional CWValue2 As Variant, Optional CWValue3 As Variant) As Variant

Dim Veh As Vehicle
Dim Result As Variant

Set Veh = New Vehicle

If IsNull(CWValueIn) Or IsNull(ClientValueIn) Then
CreateTestClass = 0
Exit Function
Else


Select Case test

    Case "BHP"
        Result = Veh.BhpRank(ClientValueIn, CWValueIn)

    Case "KW"
        Result = Veh.KWRank(ClientValueIn, CWValueIn)

    Case "Character"
        Result = Veh.CharacterRank(ClientValueIn, CWValueIn)

    Case "KWStr"
        Result = Veh.KWStrRank(ClientValueIn, CWValueIn)

    Case "BPStrRank"
        Result = Veh.BhpStrRank(ClientValueIn, CWValueIn)

    Case "Engine"
        Result = Veh.EngineRank(ClientValueIn, CWValueIn)

    Case "CC"
        Result = Veh.CCRank(ClientValueIn, CWValueIn)

    Case "Fuel"
        Result = Veh.FuelRank(ClientValueIn, CWValueIn)

    Case "NomStr"
        Result = Veh.NomStrRank(ClientValueIn, CWValueIn)
        
'    Case "Nom"
'        Result = Veh.NomRank(ClientValueIn, CWValueIn)

    Case "GetstrNom"
        Result = Veh.GetStrNomCC(ClientValueIn)
        
    Case "GetstrNomRev"
        Result = Veh.StrNomReverseRank(ClientValueIn, CWValueIn)
        
    Case "GetValvesStr"
        Result = Veh.GetStrValves(ClientValueIn)
    Case "NomCalc"
    
        Result = Veh.NomCalcRank(ClientValueIn, CWValueIn)

    Case "Doors"
        Result = Veh.DoorRank(ClientValueIn, CWValueIn)

    Case "Valves"
        Result = Veh.ValveRank(ClientValueIn, CLng(CWValueIn), CWValue2)
    
    Case "ValvesRev"
        Result = Veh.ValveReverseRank(ClientValueIn, CWValueIn)
        
    Case "Drive"
        Result = Veh.GetDrive(ClientValueIn)
        
    Case "DriveRev"
        Result = Veh.DriveReverseRank(ClientValueIn, CWValueIn)
        
    Case "KeyWords"
        Result = Veh.KeywordsRank(ClientValueIn, CWValueIn)
        
    Case "Model"
        Result = Veh.ModelRank(ClientValueIn, CWValueIn)
    Case "Date"
       
        
        
        
        
        
        
        
        
        
        
        
        
        
        Result = Veh.DateRank(ClientValueIn, CWValueIn, CWValue2, CWValue3)
        
End Select
End If
CreateTestClass = Result

End Function

'daterank function

Public Function DateRank(ClientIntroDateIn As Variant, CWIntroDateIn As Variant, Optional ClientTermdateIn As Variant, Optional CWTermdateIn As Variant) As Integer

Dim CWIntroDate As Date
Dim ClientIntroDate As Date
Dim CWTermDate As Date
Dim ClientTermDate As Date
Dim Counter As Integer
Dim ClientTermDateAvailable As Boolean
Dim CWTermDateAvailable As Boolean
Dim ClientintroDateAvailable As Boolean
Dim CWintroDateAvailable As Boolean
Dim AllTerminationDatesAvailable As Boolean
Dim AllintroDatesAvailable As Boolean
Dim AllDatesAvailable As Boolean
Dim IntroYearPass As Boolean
Dim TermYearPass As Boolean
Dim VarianceIntroYear As Integer
Dim VarianceTermYear As Integer
Dim LifeCycleExpired As Integer
Dim RemainingLifeCycle As Integer
Dim LifeCycleYears As Integer



end function

Answer : run time error: you entered an expression that has no value

You can use the iserror function
=iif(iserror( [Forms]![main]![FrmLifeCycleModelVariant]![Life Cycle].[Value],0, [Forms]![main]![FrmLifeCycleModelVariant]![Life Cycle].[Value])

Random Solutions  
 
programming4us programming4us