D
dbl
Hi I have the following 2 pieces of code which give me the results that I
need but I need them to work together, how do I go about joining them
together so that the code works out that its a "PrivateCar" so that the
excess will be X or if its a "CommercialVeh/Van" so the excess will be Y
rather that the operator having to see if its a car or commercial vehicle
then selecting which procedure to use to work out the excess. The first
procedure works from a combo box on exit event procedure and the second
procedure currently working from a tick box.
I would like it to all work from the combo box on exit procedure.
(First Procedure)
If Me.CarCommercial = "PrivateCar" Then
Dim crit As String
Dim ed As Currency
crit = "[CustomerID]=" & Me.CustomerID
Select Case Me.ExAge
Case Is < 21
ed = DLookup("[EMExcess]+[Under21]", "qryCheckRecSent", crit)
Case 21 To 24
ed = DLookup("[EMExcess]+[Under25]", "qryCheckRecSent", crit)
Case Else
ed = DLookup("[EMExcess]", "qryCheckRecSent", crit)
End Select
If Me.ExAge >= 25 And Me.Text472 < 1 Then
ed = ed + DLookup("[Novice25Plus]", "qryCheckRecSent", crit)
End If
End If
Me.ExcessDue = ed
(Second Procedure)
If Me.CarCommercial = "CommercialVeh/Van" Then
Dim crit As String
Dim ed As Currency
crit = "[CustomerID]=" & Me.CustomerID
Select Case Me.ExAge
Case Is < 21
ed = DLookup("[EMCommercialExcess]+[Under21]", "qryCheckRecSent", crit)
Case 21 To 24
ed = DLookup("[EMCommercialExcess]+[Under25]", "qryCheckRecSent", crit)
Case Else
ed = DLookup("[EMCommercialExcess]", "qryCheckRecSent", crit)
End Select
If Me.ExAge >= 25 And Me.Text472 < 1 Then
ed = ed + DLookup("[Novice25Plus]", "qryCheckRecSent", crit)
End If
End If
Me.ExcessDue = ed
Any help would be appreciated.
Thanks Bob
need but I need them to work together, how do I go about joining them
together so that the code works out that its a "PrivateCar" so that the
excess will be X or if its a "CommercialVeh/Van" so the excess will be Y
rather that the operator having to see if its a car or commercial vehicle
then selecting which procedure to use to work out the excess. The first
procedure works from a combo box on exit event procedure and the second
procedure currently working from a tick box.
I would like it to all work from the combo box on exit procedure.
(First Procedure)
If Me.CarCommercial = "PrivateCar" Then
Dim crit As String
Dim ed As Currency
crit = "[CustomerID]=" & Me.CustomerID
Select Case Me.ExAge
Case Is < 21
ed = DLookup("[EMExcess]+[Under21]", "qryCheckRecSent", crit)
Case 21 To 24
ed = DLookup("[EMExcess]+[Under25]", "qryCheckRecSent", crit)
Case Else
ed = DLookup("[EMExcess]", "qryCheckRecSent", crit)
End Select
If Me.ExAge >= 25 And Me.Text472 < 1 Then
ed = ed + DLookup("[Novice25Plus]", "qryCheckRecSent", crit)
End If
End If
Me.ExcessDue = ed
(Second Procedure)
If Me.CarCommercial = "CommercialVeh/Van" Then
Dim crit As String
Dim ed As Currency
crit = "[CustomerID]=" & Me.CustomerID
Select Case Me.ExAge
Case Is < 21
ed = DLookup("[EMCommercialExcess]+[Under21]", "qryCheckRecSent", crit)
Case 21 To 24
ed = DLookup("[EMCommercialExcess]+[Under25]", "qryCheckRecSent", crit)
Case Else
ed = DLookup("[EMCommercialExcess]", "qryCheckRecSent", crit)
End Select
If Me.ExAge >= 25 And Me.Text472 < 1 Then
ed = ed + DLookup("[Novice25Plus]", "qryCheckRecSent", crit)
End If
End If
Me.ExcessDue = ed
Any help would be appreciated.
Thanks Bob