We help IT Professionals succeed at work.

Dmax in cfquery not working

Shawn
Shawn asked
on
Medium Priority
204 Views
Last Modified: 2013-12-24
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>
Comment
Watch Question

CERTIFIED EXPERT

Commented:
how about

select top 1 tblDailyRates.CurrencyRateDate AS aaa
FROM tblDailyRates
Order By tblDailyRates.CurrencyRateDate Desc, tblDailyRates.tblDailyRates Desc
CERTIFIED EXPERT

Commented:
major typo
Order By tblDailyRates.CurrencyRateDate Desc

Commented:
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

Author

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

CERTIFIED EXPERT

Commented:
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"

Author

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
Commented:
Closed, 125 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.