Can you use DSUM in CFC query?

I am trying to create a query that returns,
Today, MTD, and YTD columns.  It can be done in Access like this:
SELECT G.TranDate, G.Desc
, DSum("amount","GLTest","trandate =DateSerial(2009, 2, 1)") AS Today
, DSum("amount","GLTest","trandate >=DateSerial(2009, 2, 1) AND trandate <= DateSerial(2009, 2, 15)") AS MTD
, DSum("amount","GLTest","trandate >=DateSerial(2009, 1, 1) AND trandate <= DateSerial(2009, 2, 15)") AS YTD
, DSum("amount","GLTest","trandate =DateSerial(2008, 2, 1)") AS LY_Today
, DSum("amount","GLTest","trandate >=DateSerial(2008, 2, 1) AND trandate <= DateSerial(2008, 2, 15)") AS LY_MTD
, DSum("amount","GLTest","trandate >=DateSerial(2008, 1, 1) AND trandate <= DateSerial(2008, 2, 15)") AS LY_YTD
FROM GLTest AS G
WHERE (((G.[TranDate])=#2/15/2009#))
ORDER BY 1;
But, this is the result in an actual CFC test:
Error Executing Database Query. 
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft]
[ODBC Microsoft Access Driver] Too few parameters. Expected 2. 
The error occurred in C:\Inetpub\wwwroot\Daily2006NoForms\CFCS\Test.cfc:
Called from C:\Inetpub\wwwroot\Daily2006NoForms\cfcTester.cfm: line 124
Called from C:\Inetpub\wwwroot\Daily2006NoForms\CFCS\Test.cfc: line 169
Called from C:\Inetpub\wwwroot\Daily2006NoForms\cfcTester.cfm: line 124
<cfquery>
SELECT glt_trandate, glt_desc, glt_amount
, DSUM("glt_amount", "GLTrans", "glt_trandate =#createODBCDate(toDate)#") AS MTD
FROM GLTrans
WHERE ((glt_trandate) = #createODBCDate(toDate)#)
</cfquery>
This is what is actually being sent.
SELECT glt_trandate, glt_desc, glt_amount
, DSUM("glt_amount", "GLTrans", "glt_trandate ={d '2009-12-02'}") AS MTD FROM GLTrans
WHERE ((glt_trandate) = {d '2009-12-02'})

I'll first-up concede that I have't used Access since I was at polytech.  So anything I offer up here is going to be vague, and based on recollections of reading about other people's problems with it.
I'd usually strum up an Access DB and have a mess around with it, but I don't have MS Office installed on this machine, and I can't be arsed downloading a trial of the thing just to sort out one query.  I'm sure you understand ;-)
Firstly, one recollection I have is that whilst the query tool in Access is quite forgiving of non-standard SQL, JDBC drivers are not.  One thing that could cause gyp is using double-quotes instead of single-quotes.  I know the Acces query tool will accept double quotes, but they're not actually valid in SQL.  So perhaps try single quotes instead.
Also I am really surprised that you have success using CF's "ODBC date format" - eg: {d '2009-12-02'} - when Access expects dates like this: #2/12/2009#.  I know this has not worked for people in the past.  I think just '2009-12-02' might work, but don't quote me on that.  Or just do it "properly" my using a <cfqueryparam> (which as I touched on, you should be doing as a matter of course anyhow).
That "Too few parameters" error Access spits out is a fairly ubiquitous one: it seems to be what it says whenever it sees an expression it doesn't understand.  So I would not put too much stock in that actually being the problem.
Have you tried taking the SQL that CF is passing to the driver, and running that straight in Access's query tool?  It might give a better error.
Of course no post about Access problems would be complete without the caveat that Access is not intended to be used as a server-based DB solution, it's a desktop app, so it's completely inappropriate to be used as a DB for a multi-user environment such as a website back-end.  So if there's any way you could possibly stop using Access and use a proper DB system, that would be the best thing to do: if, for example, you are only just starting the project and you would not take too much of a hit from swapping Access out.  It might not be an option, or it might be outwith your control, I guess.
Adam

Similar Messages

  • Can we use Result from another query in Webi using Bex uery universe?

    Hi,
    Can we use Result from another query filter option in Webi to create a report using a Bex Query universe?
    I need to create a report using two universes, one is Bex Query Universe and the other is Orcle universe. I have two queries, one is using Oracle universe; the other using Bex Query universe. I need to pass the Oracle data from the Oracle query to the Bex Query query to get the matched data from SAP Bex query.
    I used Result from another query in the query filter panel for the query using Bex query universe. But I got an error saying that 'A filter contains a wrong value. you cannot run this query. (Error: WIS 00007). The data used in the filter on both sides are the same. they are char.
    I have tested by using two queries from the same Bex query universe to see if the Result from another query filter option works. And I got the same error.
    Has anyone run into the same issue and if this is possible and what should be the solution?
    Thanks in advance!
    Edited by: BO_Haiyan on Oct 6, 2010 3:47 PM

    In that situation:
    Create two queries : Oracle and BW query.
    @ Report:
    As you have to see result set from both the Dataproviders, correct? To achieve thise one must have common dimension objects to merge them at report and use Objects those are coming from both queries to use them in single Table/Report.
    Unless you don't use Merge Dimensions, you don't get a chane to use both queries objects in single Table/Report. (It will give tooltip saying: You can't drop here -- Incompatable Objects)
    In case, if you don't have common dimensions, change object definitions to Detail objects, for those required.
    Hope it helps you.
    Thank You!!

  • Can you use the same Apple ID on more than one MacBook Pro for updates and applications?

    We just got a few new MacBook Pro's and when I went to install updates it said I need to make an Apple ID.  Can you use the same Apple ID and email address for that Apple ID on multiple machines, or do I need them both to be unique per machine?  I'm not sure how that works when you have multiple machines.

    An Apple ID is a user name you use for everything you do with Apple. Creating an account for an Apple service, such as the iTunes Store or the App Store, creates an Apple ID. Apple ID allows you to access other Apple services.   So you can use the same Apple ID for up to 10 Macs associated with it.
    To create an Apple ID you need to enter  your full name and your primary email address as your Apple ID. This will be used as the contact email address for your account.

  • How many Ipods can you use with one Itunes account?

    How many iPods can you use/sync with one iTunes account?

    PT wrote:
    Macistotle wrote:
    Unless you have DRM still haunting your tunes ... Then you can only use those songs on 5 devices. Otherwise, connect as many as you like (as stated above).
    No, you can sync your DRM tracks to an unlimited number of iPods (but only authorized to play on 5 different computers/user accounts)
    Patrick
    So I can sync two iPods to my iTunes account and sync the same digital copy movies that come with some o' my DVDs to both ipods? Do movies make a difference really, DRM-Wise? Thanks in advance.

  • Can you use a iTunes card to purchase more storage for iCloud

    can you use a itunes card to purchase more storage for icloud

    No. iTunes Store only.
    "An iTunes Gift Card lets you shop for anything at the iTunes Store "  >  http://store.apple.com/us/browse/home/giftcards/itunes/gallery

  • Can you use soundtrack pro's loops in your youtube videos or do you need to purchase a license since it is royalty free?

    Can you use soundtrack pro's loops in your youtube videos or do you need to purchase a license since it is royalty free?
    I understand they are royalty free, I am just confused about using the actual loops for films, videos, etc - if there is a special license you must purchase or what?
    Yes sure, it's a library and may be used a lot - but is it legal or against agreement?
    And to clarify - what about music I create on the program , that is ok right?

    If you purchased the software you have the right to use the loops that came with the software in the software to make whatever you want.

  • Can you use the Airport Express A1264 as an AP and a DHCP server at the same time?

    Can you use the Airport Express A1264 as an Access Point and a DHCP server at the same time?
    I would like to use it as a DHCP server and AP at the same time in my LAN (no internet, just local machines through a few switches). I was lead to belive this could be the case from a few networking friends that haven't been friendly enough to help me out setting it up.

    I need it to act as a dLink/Cisco/Linksys/etc basic wifi router, in the fact that you can access it via wifi, and it will spit out DHCP addresses (192.168.1.xxx) to everything wired downstream of it.
    I want to simultaniously provide a Wifi connection and a LAN connection at the same time
    Thanks,
    BRad

  • HT204053 Can you use the same Apple ID for two devices ?

    I have an MacPro and I am buying an iPad.  Can you use the same Apple ID for two devices or should I create an new AppleID for the ipad?

    Welcome to Apple Support Communities
    The Apple ID purpose is to have the same data in all your devices and share your purchases among all your devices, so you can use your Apple ID in both devices

  • Can you use FaceTime using two iPads with same apple id

    Have two iPads for wife and I. Both use same apple ID account. Can you use FaceTime between them?

    Heres what you do. got to settings>facetime>add an email and than add another email (note: cannot be the same email that you use on your apple ID) A verifaction email will be sent. Go to your email account and verify the email by clicking on the link. Now using the other ipad, make a facetime call to the email you just verified and you can now facetime between the two!
    One more side note. Make sure that only the email you just verified has a check mark on it. The other ipad shoud have a check mark next to the orginal apple ID email.

  • Can you use 2 Thunderbolt Displays with Windows 7/Bootcamp on a Early 2011 Macbook pro?

    Can you use 2 Thunderbolt Displays with Windows 7/Bootcamp on a Early 2011 Macbook pro?
    I have 2 and cannot seem to get them to work?

    Can you use 2 Thunderbolt Displays with Windows 7/Bootcamp on a Early 2011 Macbook pro?
    I have 2 and cannot seem to get them to work?

  • How can you use iMessage between 3 iPads with 3 different users but only one Apple ID?

    how can you use iMessage between 3 iPads with 3 different users but only one Apple ID?

    No you do not need separate Apple ID's in order to use 3 devices with one Apple ID. I use 4 devices to Message and FaceTime and all use the same Apple ID. You do need to add additional email addresses for the other devices.
    Look at this very informative video for the instructions.
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l

  • Can you use one PC for 2 different Ipods, with out erasing the others music from Itunes?

    Can you use one PC for different Ipod touch's , with out erasing the other persons Itunes music?

    Yes.  See:
    How to use multiple iPods, iPads, or iPhones with one computer

  • HT4759 can you use the same apple id for two phones on the cloud?

    can you use the same apple id for two phones on the same verizon account and if so can you keep there contacts etc. separate?

    If you want to keep your contacts and other data you sync with iCloud separate, you'll have to create separate iCloud accounts, which will require different IDs.  If you share the same iCloud account/ID on multiple devices, the synced data will be merged and will appear on all devices syncing with the shared account.
    You can still share the same ID for iTunes; it doesn't have to be the same as the one used for iCloud.

  • How can you use the same e-mail address for multiple ipads?

    I have two iPads.. an iPad and an ipad 2.  I registared my new ipad 2 and now my old ipad is will not let me log on and is telling me that my e-mail address is already in use.  how can you use the same e-mail address for multiple ipads?

    And by using the same Apple ID you can also share purchases.  If you have a different Apple ID for each iPhone then you can't share purchases.

  • Can you use home share where there are 2 itunes on the same computer but under different user profiles?

    Can you use 'Home Share' where there are 2 itunes on the same computer, but under different user profiles?

    check out method one from this support article -> How to use multiple iPods, iPads, or iPhones with one computer

Maybe you are looking for

  • Urgent+Urgent Plz:- ORA-00942: table or view does not exist

    When i create a table through running a query in sql developer,it creates and i can verify its existence and its contents with GUI tools like SQL Developer and Oracle Application Express home but i cannot access it through my own select query anywher

  • Unable to sync to itunes

    i keep trying to sync to itunes with my 3gs, just updated to ios4, and it said The iphone can not be synced, the required file can not be found.!!!!!!!!!! help

  • Regular Expression match for BOM char .

    i am trying to match BOM char in file with regex but \\ufeff seem to be not working . please suggest solution on this

  • Looking for Dan Issacs HD - SD Conversion Instructions for CS4

    I have tried to piece together instructions I've found on the web to author a decent DVD using HDV footage utilizing Dan Issacs method. However, I really would love to see the exact instructions he wrote - but I can't find them anywhere on the intern

  • Posting Combo Box to Text Area

    Hello I am doing a Java project for school and have come across a snag. I have a program the takes input in several Text Fields plus one Combo Box. Then the Store Button is pressed (registered action listener) the data is displayed in a Text Area. I