Steve Schapel
miscellany at mvps.org
Thu Dec 17 13:42:44 CST 2009
John,
If I understand you correctly (which I am not sure of!) this might be what
you need...
Me.curMRate = DLookup("[curMRate]","qryMileageByDate")
Regards
Steve
--------------------------------------------------
From: "John Clark" <John.Clark at niagaracounty.com>
Sent: Friday, December 18, 2009 7:46 AM
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Subject: [AccessD] Try this one again
> OK...about a month ago, I asked for help on this, and I did get some...one
> that seemed really promising...but nothing worked. It has to be
> easy...something common. I was pulled away from this project, but now,
> w/the end of the year coming, they want it quick, so I've got a couple of
> days to finish it. I've already got an idea of how to avoid the problem
> all together, but it won't be the "proper" way to do it, IMHO. So, I'd
> like to complete it, how I want to do it.
>
> How do I get information from a query, into my form, and thus, if
> necessary, into my table?
>
> I've got a query, which I got help on, from you guys, that works
> great...as a query. Enter a date and you will get the single value for
> that date. The SQL for the query is:
>
> SELECT TOP 1 tblMileageRate.datDate, tblMileageRate.curMRate
> FROM tblMileageRate
> WHERE (((tblMileageRate.datDate)<[Date Entered]))
> ORDER BY tblMileageRate.datDate DESC;
>
> But, I've tried so many ways to do this right from the form, and I cannot
> get it to work. I looked into A.D.'s example, and I think it has gotten me
> close...I tried a statement like Me.curMRate.Value = "qryMileageByDate"
> but this isn't quite right either...says I can't assign a value to this
> object.
>
> I've already started whipping up a substitute program that avoids any of
> this stuff, but it is not what I wanted. I want the user to be able to
> lookup a record and the rates for the date of that record will always be
> in there.
>
> Here is the really dumb thing about it...I've done this before. I wrote a
> program that did pretty much exactly what I am trying to do. But, that was
> 4-5 years ago, and I really haven't done much coding in that time.
>
> To put the question simply, how do I send a date to a query, from a form,
> and get back a rate based on that date...this would be the latest entry as
> of the entered date...basically what the code above does, but via the
> form?
>
> Thank you very much for all the help so far, by the way!
>
> John Clark