[AccessD] Query question ... Finding the proper rate/per date

John Clark John.Clark at niagaracounty.com
Thu Nov 5 11:05:16 CST 2009


No sir, I did not. Man I am struggling w/this thing. I haven't been using access, for quite a while now, and I'm trying to remember stuff that I've done and it just isn't coming to me. The query, as Stuart gave, is working great...I will be adding the "<=" adjustment too...but I want to grab that result and put it into my form, and the record as well.
 
I thought I knew exactly how to do this, but the VBA doesn't seem to like that "TOP" command at all. I started down the path of creating a SQL string and running docmd.runSQL, but that door closed too...I might go back to this, because I think I was making mistakes w/it.

>>> "Reuben Cummings" <accessd at gfconsultants.com> 11/5/2009 8:58 AM >>>
John, did you get the following request answered?

Reuben Cummings
GFC, LLC
812.523.1017

> 
> I'm sorry to ask this...but I haven't written anything, aside 
> from one very miniscule little program, in about two years, 
> and apparently the magic is gone...I am lost. This code that 
> Stuart offered up is exactly what I was looking to do, 
> however, I'd like to do it from a form and what I thought I 
> needed to do is not working. 
>  
> I want to (A) have the rate come up, once a given date is 
> entered, and be there already when an old record is 
> accessed...I want to be able to say, "this was entered on 
> <date> and this was the rate at that time." And, (B) I want 
> it to multiply the number of miles w/this rate and present a 
> total. And (C) I want to do pick the going fee out of a 
> similar table and add this to the equation. I think if I can 
> do one of these, I can do them all.
>  
> How can I grab this, when a new date is entered?
>  
> Here is the code I am using, in the query, which works...
>  
> SELECT TOP 1 tblMileageRate.datDate, tblMileageRate.curMRate
> 'FROM tblMileageRate
> 'WHERE (((tblMileageRate.datDate) < [Date Entered]))
> 'ORDER BY tblMileageRate.datDate DESC;
> 



More information about the AccessD mailing list