
April 4th, 2004, 05:19 AM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 2
Time spent in forums: 3 m 46 sec
Reputation Power: 0
|
|
Dates confusion between US and UK format
Using the following lookup on 4th February 2004
testdate = DLookup("Endate", "tblBaseRates", "tblBaseRates.EnDate = #04/02/2004#")
it's returning a null value.
4th February 2004 does exist in the table.
If I change the value to #02/04/2004# (2nd April 2004) it returns this as the value.
If I run a query using the Query Grid to find the correct BAseRate record using as criteria tblBaseRates.StDate <=#02/4/2004# AND tblBaseRates.EnDate > =#02/04/2004# then it returns Baserate record with an STDate of 05/02/04 which is what I expect.
If I run that same query as vba code, substituting variables for the criteria date, it returns the Base Rate record that has an EnDate of 04/02/04
I'm further confused by the fact that the Query Grid when viewed in SQL has transposed 02/04/04 to 04/02/04 but still returns the anticipated record.
This is part of a routine where I'm trying to calculate Interest costs for transactions. The Base rate can change during the life of the transaction, and I need to accumulate the interest for the whole life of the transaction. The routine will handle multiple transactions, each with independant "interest start dates"
The interest rates, and start and end dates for each interest band are held in tblBaseRates and the transactions in tblTransactions
Any ideas would be much appreciated. currently I'm looping through the transaction table, then with each transaction looping through the baserate table, accumulating interest cost as I go. With several thousand transactions it's a very slow way to get the result. Any ideas on a better solution would be appreciated. That said, if I can't resolve the Dates issue, I'm at a dead end anyway.
Last edited by Twilight : April 4th, 2004 at 05:54 AM.
Reason: Description incorrect
|