Dmax in cfquery not working

works in access but when I insert in cfquery I get an error of too few parameters

<cfquery name="q_LatestDate" datasource="#application.DS#" username="#application.dbuser#" password="#application.dbpass#">
SELECT tblDailyRates.CurrencyRateDate AS aaa
FROM tblDailyRates
WHERE (((tblDailyRates.CurrencyRateDate)=DMax("CurrencyRateDate","tblDailyRates")));
</cfquery>
LVL 1
ShawnAsked:
Who is Participating?
 
GranModCommented:
Closed, 125 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0
 
dgrafxCommented:
how about

select top 1 tblDailyRates.CurrencyRateDate AS aaa
FROM tblDailyRates
Order By tblDailyRates.CurrencyRateDate Desc, tblDailyRates.tblDailyRates Desc
0
 
dgrafxCommented:
major typo
Order By tblDailyRates.CurrencyRateDate Desc
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
PluckaCommented:
Shawnaraxi,

What's with the brackets, try this

WHERE tblDailyRates.CurrencyRateDate = DMax("CurrencyRateDate","tblDailyRates");

or without the ;

WHERE tblDailyRates.CurrencyRateDate = DMax("CurrencyRateDate","tblDailyRates")

Regards
Plucka
0
 
ShawnAuthor Commented:
found it. it seems access driver doesn't support the Dmax function

the workaround is simply to use Max instead of Dmax

SELECT max(tblDailyRates.CurrencyRateDate) AS aaa
FROM tblDailyRates

0
 
dgrafxCommented:
Even though I didn't post correct answer access does recognize dMax()

and I refer to the opening post on this question
"works in access but when I insert in cfquery I get an error of too few parameters"
0
 
ShawnAuthor Commented:
you're right acces does accept dmax (I use it quite often). I pointed out that the 'driver' used in CF doesn't suport dmax
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.