I can't get DLookup to use the RateCode string that was passed into the function in its criteria. The RateCode is a letter that corresponds to a certain rate schedule in RateTable. It is ignoring it for some reason. What am I doing wrong?
******
Public Function getCustomerSpecificMileage(RateCode As String, Miles As Integer) As Currency
'This function gets the Mileage Rate from the Rate table
'and the Miles is passed into it, it then calculates the Mileage and
'returns the Mileage value in dollars
Dim Rate As Currency
Rate = DLookup("[NRate]", "RateTable", "[RateCode] = RateCode And [Title] = 'MileageRate'")
getCustomerSpecificMileage = Rate * Miles
End Function
******
Thanks,
Craig
******
Public Function getCustomerSpecificMileage(RateCode As String, Miles As Integer) As Currency
'This function gets the Mileage Rate from the Rate table
'and the Miles is passed into it, it then calculates the Mileage and
'returns the Mileage value in dollars
Dim Rate As Currency
Rate = DLookup("[NRate]", "RateTable", "[RateCode] = RateCode And [Title] = 'MileageRate'")
getCustomerSpecificMileage = Rate * Miles
End Function
******
Thanks,
Craig