移動距離から金額を求める

Public Function get_idokin(p距離 As Currency)
    
    If p距離 = 0 Then 'ガードと言ったり、早期リターン
        get_idokin = 0
        Exit Function
    End If
    
    Dim rs As ADODB.Recordset
    
    
    Set rs = OpenRecordset("select 単価 from T_買い物交通費 where ? >= 距離_from order by 距離_from DESC", p距離)
    If rs.EOF Then
        get_idokin = 0
    Else
        get_idokin = rs!単価
    End If
    rs.Close
    
End Function
/* -----codeの行番号----- */