• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

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>
0
Shawn
Asked:
Shawn
1 Solution
 
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
 
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now