Hi all - weird stuff.
I have a table of tax rates
Maricopa Phoenix 0 0.063 0.018 0.35
I have a function that gets the tax rate based on county, city & zip. There are NO calculations performed in this function - just decision on which row to return.
In a query, I am using that function to return the city rate (because I can't figure out a way to return an array and populate multiple columns of the query - but that would be anoter post).
In the query I get:
Phoenix AZ 85086 Maricopa 1.79999992251396E-02
What happened to my accurate 0.018???
The function is basically:
***********************************************************
' Find a match for county, city, zip
strSQL = "SELECT * FROM tblAZTaxRates" & _
" WHERE ((tblAZTaxRates.strCity)='" & varCity & "'" & _
" AND ((tblAZTaxRates.strZip)='' OR isnull(tblAZTaxRates.strZip))" & _
" AND (tblAZTaxRates.strCounty)='" & varCounty & "'" & _
" AND (tblAZTaxRates.datEffective)<=#" & Date & "#)" & _
" ORDER BY (tblAZTaxRates.datEffective) DESC;"
'debug.print strSQL
rs.Open strSQL, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
With rs
If Not (.EOF Or .BOF) Then
.MoveFirst
found = True
varCountyTaxRate = .Fields("numCountyTaxRate")
varStateTaxRate = .Fields("numStateTaxRate")
varCityTaxRate = .Fields("numCityTaxRate")
varDiscountRate = .Fields("numDiscountRate")
End If
.Close
End With
End If
***********************************************************
Thanks for any insight on this.
/Wendy
PS: I know I could round to 3 decimals and get what I need - for this example, but occassionally we do need to go out to 4 places, so I might run into a problem there.
I have a table of tax rates
Maricopa Phoenix 0 0.063 0.018 0.35
I have a function that gets the tax rate based on county, city & zip. There are NO calculations performed in this function - just decision on which row to return.
In a query, I am using that function to return the city rate (because I can't figure out a way to return an array and populate multiple columns of the query - but that would be anoter post).
In the query I get:
Phoenix AZ 85086 Maricopa 1.79999992251396E-02
What happened to my accurate 0.018???
The function is basically:
***********************************************************
' Find a match for county, city, zip
strSQL = "SELECT * FROM tblAZTaxRates" & _
" WHERE ((tblAZTaxRates.strCity)='" & varCity & "'" & _
" AND ((tblAZTaxRates.strZip)='' OR isnull(tblAZTaxRates.strZip))" & _
" AND (tblAZTaxRates.strCounty)='" & varCounty & "'" & _
" AND (tblAZTaxRates.datEffective)<=#" & Date & "#)" & _
" ORDER BY (tblAZTaxRates.datEffective) DESC;"
'debug.print strSQL
rs.Open strSQL, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
With rs
If Not (.EOF Or .BOF) Then
.MoveFirst
found = True
varCountyTaxRate = .Fields("numCountyTaxRate")
varStateTaxRate = .Fields("numStateTaxRate")
varCityTaxRate = .Fields("numCityTaxRate")
varDiscountRate = .Fields("numDiscountRate")
End If
.Close
End With
End If
***********************************************************
Thanks for any insight on this.
/Wendy
PS: I know I could round to 3 decimals and get what I need - for this example, but occassionally we do need to go out to 4 places, so I might run into a problem there.