Query SQL code gets deleted after export to Excel. "Query must have at least one destination field"

Hi all,
I'm getting really frustrated by this Access error. It happens when I export the result of a query through an Access macro to Excel, the first time it runs well but the next time, there is a chance that the query won't run and the error "Query
must have at least one destination field" will be displayed. After that, I try to check the query SQL code and discover the code has vanished. I'm using simple Select query without joins, only "where", "group by" and "order by"
statements.
Thank you in advance for your help,
Jesus 
Edit:
One of these queries are like the following (all of them are of this type):
SELECT Field1, field2, field3, field4, field5, Sum(Field6) AS SumOfField6, Sum(Field7) AS SumOfField7
FROM Table1
WHERE Field6 is not null
GROUP BY Field1, field2, field3, field4, field5
Order By Sum(Field6) desc

Hi Peter, 
Thank you for your response, I updated the original question with one of the codes.
Thanks,
Jesus

Similar Messages

  • How to make this query executable in SSRS: The query cannot be prepared: The query must have at least one axis.

    WITH 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay]    AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[PreviousDay]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .PREVMEMBER  }
    , [Measures].CURRENTMEMBER) 
    MEMBER [FYDay].[DateHierarchy].[CurrentDay1]           AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .LEAD(1)  }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay2]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(2)  }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay3]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .LEAD(3)  }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay4]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .LEAD(4)  }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay5]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .LEAD(5)    }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay6]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .LEAD(6)  }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[CurrentDay7]          AS AGGREGATE( 
    {  [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]  .LEAD(7)  }
    , [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[PTD]                         AS AGGREGATE(PERIODSTODATE([FYDay].[DateHierarchy].[FPERIOD], 
      [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]
    ), [Measures].CURRENTMEMBER) 
     MEMBER [FYDay].[DateHierarchy].[WTD]                         AS AGGREGATE(PERIODSTODATE([FYDay].[DateHierarchy].[FWEEK], 
     [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]
    ), [Measures].CURRENTMEMBER) 
    SELECT  
     [FYDay].[DateHierarchy].[WTD], 
           [FYDay].[DateHierarchy].[PTD], 
           [FYDay].[DateHierarchy].[PreviousDay], 
           [FYDay].[DateHierarchy].[CurrentDay], 
           [FYDay].[DateHierarchy].[CurrentDay1], 
           [FYDay].[DateHierarchy].[CurrentDay2], 
           [FYDay].[DateHierarchy].[CurrentDay3], 
           [FYDay].[DateHierarchy].[CurrentDay4], 
           [FYDay].[DateHierarchy].[CurrentDay5], 
           [FYDay].[DateHierarchy].[CurrentDay6], 
           [FYDay].[DateHierarchy].[CurrentDay7] 
     } ON COLUMNS, 
     [Measures].[Store Budget], 
     [MEASURES].[SNAPSHOTSOLDAMOUNT], 
     [MEASURES].[SHIPPEDAMOUNT], 
     [MEASURES].[SHIPPED VS SOLD], 
     [Measures].[% To Budget]
     {[STOREMASTER].[SERVICINGDC].[SERVICINGDC].ALLMEMBERS} 
     )} ON ROWS 
     from ( select {[STOREMASTER].[SERVICINGDC].&[Houston]} on columns 
     FROM [Model] 

    Hi Ramparasad,
    In your query, you add a measures and dimension on Row axis which is not supported in query designer in SSRS. Please use the query below.
    WITH
    MEMBER [FYDay].[DateHierarchy].[CurrentDay] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[PreviousDay] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .PREVMEMBER }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay1] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(1) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay2] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(2) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay3] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(3) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay4] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(4) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay5] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(5) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay6] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(6) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[CurrentDay7] AS AGGREGATE(
    { [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014] .LEAD(7) }
    , [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[PTD] AS AGGREGATE(PERIODSTODATE([FYDay].[DateHierarchy].[FPERIOD],
    [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]
    ), [Measures].CURRENTMEMBER)
    MEMBER [FYDay].[DateHierarchy].[WTD] AS AGGREGATE(PERIODSTODATE([FYDay].[DateHierarchy].[FWEEK],
    [FYDay].[DateHierarchy].[FYEAR].&[2014].&[4].&[10].&[41].&[09/11/2014]
    ), [Measures].CURRENTMEMBER)
    SELECT
    [Measures].[Store Budget],
    [MEASURES].[SNAPSHOTSOLDAMOUNT],
    [MEASURES].[SHIPPEDAMOUNT],
    [MEASURES].[SHIPPED VS SOLD],
    [Measures].[% To Budget]
    }ON COLUMNS,
    { [FYDay].[DateHierarchy].[WTD],
    [FYDay].[DateHierarchy].[PTD],
    [FYDay].[DateHierarchy].[PreviousDay],
    [FYDay].[DateHierarchy].[CurrentDay],
    [FYDay].[DateHierarchy].[CurrentDay1],
    [FYDay].[DateHierarchy].[CurrentDay2],
    [FYDay].[DateHierarchy].[CurrentDay3],
    [FYDay].[DateHierarchy].[CurrentDay4],
    [FYDay].[DateHierarchy].[CurrentDay5],
    [FYDay].[DateHierarchy].[CurrentDay6],
    [FYDay].[DateHierarchy].[CurrentDay7]
    {[STOREMASTER].[SERVICINGDC].[SERVICINGDC].ALLMEMBERS}
    } ON ROWS
    from ( select {[STOREMASTER].[SERVICINGDC].&[Houston]} on columns
    FROM [Model]
    Regards,
    Charlie Liao
    TechNet Community Support

  • Production Reporting out put not getting deleted after 30mins what we set.

    Hi,
    This issue regarding Production Reporting. In the workspace the report output not getting deleted after 30minutes (while publishing the report settings were like delete after 30 mins). Any suggestions please .....
    Thanks
    Venkat

    Hi Deepak,
    Please chek the field / value which u have changed is relavant to  printouts of the change.
    You can check  with following path
    SPRO> MM > Purchasing > Message > Fields Relevant to Printouts of Changes.
    Confirm tick is provided for PO ( P)
    Vivek

  • Hyperlinks from other placed indd documents or pdfs getting lost after export to PDF

    after upgrade vom CS 5.5 to CS 6: hyperlinks from other placed indd documents or pdfs getting lost after export to PDF
    I tried all options for the as well known and working export options

    after upgrade vom CS 5.5 to CS 6: hyperlinks from other placed indd documents or pdfs getting lost after export to PDF
    I tried all options for the as well known and working export options

  • Sound on clips gets deleted after quiting FCP X, why?

    Sound on some clips I imported from my GoPro gets deleted after I have quit the program and go back to it.  However, in the FCP X events folder, the original media still has the sound in the clip.  I do not understand why this is happening.
    Does anybody have any advice?

    One slight point about Patrick's info.
    Since version 10.0.3, FCP X has been able to edit multicam and most people agree that it does so in a far superior and easy way.
    I would also suggest that as a beginner you completely ignore the "Help" menu as it can be very confusing.
    Instead download these 2 hours of FREE video tutorials and you will see and learn exactly how to use FCP X in no time at all:-
    http://www.izzyvideo.com/final-cut-pro-x-tutorial/
    Finally do not spend a penny on FCP X until you are sure it is right for you.
    You can achieve this by downloading the FREE 30 DAY TRIAL:-
    http://www.apple.com/finalcutpro/trial/
    So within 30 minutes of reading this post you could have FCP X sitting on your desktop and be starting to edit with it  .  .  .  and all without spending a penny!
    P.S. If you already have FCP 7 & and it does what you want, you should stick with it. If it ain't broke, don't fix it.
    Message was edited by: Ian R. Brown

  • HT201317 All the photos dowloaded to the photo stream in my mac, will it be saved forever or does it get deleted after reaching 1000 limit ?

    All the photos dowloaded to the photo stream in my mac, will it be saved forever or does it get deleted after reaching 1000 limit ?

    Photo stream photos will be deleted once you reach 1,000 unless you import them into iPhoto. You can set your iPhoto preferences to import them automatically.

  • My email seems to get deleted after i read it

    My emails seems to get deleted after I read them

    I found no settings on the iPhone which could make this happen.
    Did you sign in to www.icloud.com and check if you have accidently activated Rules (or Forwarding)?

  • Library gets deleted after I close itunes

    Hello,
    For some reason my library gets deleted after closing itunes. When I re-open itunes i can watch my recycle bin get filled up with my library its an .xml file. If I hit restore it does nothing!!! This is getting very annoying, and the geniuses at itunes blame windows (couldn't tell me why) and the sony store (where I got my computer) blames itunes! Also I get a ton of .tmp file in my itunes folder while I use itunes, and they don't delete.

    Anyone!!!!

  • Contacts getting deleted after few dats

    Hello
    I am using iphone 4. i am facing a problem that my contacts which i saved from my watsapp are getting deleted after few days automatically. Pl help me

    Contact WhatsApp since it is their issue.

  • Hyperion Workspace Financial Reporting Export to Excel Query-Ready Missing

    Hyperion Workspace Financial Reporting Export to Excel "Query-Ready" option is Missing in the dropdown when you go to File>Export>Excel
    Only the "Fully Formatted" option is available.
    From what I recall this option for a "query-ready" export should be available from the HTML preview?
    Is there something in configuration that needs to be enabled or something that needs to be checked on to get this option?
    We are running 11.1.1.3
    The Query-Ready option is available when exporting forms in Planning.
    When opening Financial Reports in Smartview the option for "Query-Ready" is available.
    For some reason this is not showing up in workspace, does it not exist in 11.1.1.3? Is this a bug?
    TIA

    Hi,
    The option to export the financial report output in "Query-Ready" format is actually at the bottom right hand corner of the report page (look at the report footer) instead of File>Export>Excel.
    Hope this helps
    Genti

  • Drill Down is not working after exporting to excel

    Hi,
    I have created a drill down report in SSRS . Its working perfect. But when I export it to excel, it is showing only the expanded nodes. But I want the same functionality which gives user to expand or collapse the nodes in Excel as well. Can any one please
    help me with this?

    Hi sil174sss,
    Per my understanding you are experiencing the issue with the excel report which have add the drill down action, after export to excel only the expanded nodes included and the collapsed nodes is not shown, right?
    Generally, if we expand the nodes before export to excel then the excel will display the expanded details row and keep collapsed the details row which haven't expand, but we have the toggle "+","-" on the left of the Excel to help
    control the expand and collapse, when you click the "+" you can expand the collapsed notes to see the details rows.
    I have tested on my local environment with different version of SSRS and can always see the "+","-" as below:
    On the Top left corner you can find the "1","2", this help to control the "Collapse All" and "Expand All".
    If you can't see the "+","-" in the excel, the issue can be caused by the Excel version you are currently using, and also excel have limit support of this, please provide us the Excel version information and the SSRS version. You
    can reference to this similar thread:
    lost collapsing columns when export to excel
    Please try to export other drill down report to excel and check if they work fine, if they did, the issue can be caused by the drill down action you have added in this report is not correctly, if possible, please try to redesign the report.
    Article below about how to add  Expand/Collapse Action to an Item for your reference:
    http://msdn.microsoft.com/en-us/library/dd220405.aspx
    If your problem still exists, please feel free to ask
    Regards
    Vicky Liu

  • Trying to change country but keep getting "You have at least one incomplete pass. Passes must be completed before you change stores" How do i complete passes

    Trying to change country but keep getting "You have at least one incomplete pass. Passes must be completed before you change stores" How do i complete passes

    I have the same problem. I found the passes page but it does not show how to complete the passes.
    BTW This is ridiculous. All I did was click an itunes link to an song I heard on a website and iTunes said, "This artist is in not in your countries iTunes store. Would you like to switch to another store to purchase?" I clicked yes and now I can't upgrade my apps, I can't switch back, I can't do anything.
    Things I've tried:
    • Turning on / off email notifications and clicking save.
    • There is nothing else I can do on this page.

  • At least one required field was empty on export. Please fill in the required fields (highlighted)

    "At least one required field was empty on export. Please fill in the required fields (highlighted)"
    I'm tearing my hair out with this one. Have checked all the fields to confirm if I had set the Type as User Entered - Required. Can't find any such field. Any help would be appreciated. Is there an email id where I can send the form?

    Hi,
    In your script when you make an object visible, you also make it mandatory. No problem there!
    However the script that hides the object goes through this sequence:
    hide the object, THEN
    make it optional/not mandatory.
    This is where the problem lies.
    You FIRST need to make the object optional/not mandatory AND THEN hide the object. It should just be a simple case of work through the various scripts and having the mandatory line before the presence line.
    There is an example here: http://assure.ly/hxHupW.
    Hope that helps,
    Niall

  • After Effects says I need to have at least two frames to render a ram preview. I multiple frames. Ho

    After Effects says I need to have at least two frames to render a ram preview. I multiple frames. How do I make it ram preview?

    First, install the most recent updates:
    http://blogs.adobe.com/aftereffects/2012/10/after-effects-cs6-11-0-2-update-bug-fixes-and- added-gpus-for-ray-traced-3d-renderer.html
    If that doesn't solve the problem for you, we need to know a lot more if we're going to help you. Please provide answers to the questions listed here: "FAQ: What information should I provide when asking a question on this forum?"

  • Need help on deleting after exporting to IDML

    Hi Forum,
    I have a script to export all the "indesign files" found inside the folder... and then remove all the indesign files...
    Instead, Can i have a help to delete....
    the indesign file after exporting to IDML and then
    continue opening the next indesign file, exporting to IDML and deleting it...
    then continue file3....
    The below is the script open indesign files and export to idml and then remove all the files inside the folder Desktop/GENERAL_CS6-IDML/IN_CS6
    var mySourceFolder = Folder("Desktop/GENERAL_CS6-IDML/IN_CS6");
    var myOutFolder = Folder("Desktop/Completed");
    //var Indd_files = get_Files(mySourceFolder,[], ".indd");
    var Indd_files = mySourceFolder.getFiles (/\.indd|\.INDD/i);
    //var Indd_files = get_Files(mySourceFolder,[], ".indd");
    if(Indd_files.length>0)
        for(var w=0;w<Indd_files.length;w++)
            try{
                 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                myDoc = app.open(File(Indd_files[w]));
                 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                 var myDocNam = stripExt((Indd_files[w].name).replace(/%20/g," "))+"idml";
                 myDoc.exportFile(ExportFormat.INDESIGN_MARKUP, (File(myOutFolder+"/"+myDocNam)));           
    //          myDoc.save(File(myOutFolder+"/"+myDocNam));
                app.activeDocument.close(SaveOptions.no);
            }catch(E){}
    try {
    var copyFolder1 = Folder("Desktop/GENERAL_CS6-IDML/IN_CS6");
    var myFiles2 = copyFolder1.getFiles(/\.indd|\.INDD/i);
    for ( i = myFiles2.length-1; i >= 0 ; i-- ){
    myFiles2[i].remove();
    } catch (e) {}
    Many thanks for the support..

    I hope this is what you expected.
    You can try the following code:
    var mySourceFolder = Folder("Desktop/GENERAL_CS6-IDML/IN_CS6");
    var myOutFolder = Folder("Desktop/Completed");
    //var Indd_files = get_Files(mySourceFolder,[], ".indd");
    var Indd_files = mySourceFolder.getFiles (/\.indd|\.INDD/i);
    //var Indd_files = get_Files(mySourceFolder,[], ".indd");
    if(Indd_files.length>0)
        for(var w=0;w<Indd_files.length;w++)
            try{
                 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                 var myFile = File(Indd_files[w]);
                myDoc = app.open(myFile);
                 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                 var myDocNam = stripExt((Indd_files[w].name).replace(/%20/g," "))+"idml";
                 myDoc.exportFile(ExportFormat.INDESIGN_MARKUP, (File(myOutFolder+"/"+myDocNam)));          
                app.activeDocument.close(SaveOptions.no);
                myFile.remove();
            }catch(E){}
    Green4ever

Maybe you are looking for

  • Payroll arrears critical situation for payment

    dear gurus, i am having a big problem in paying arrears automatically through the oracle payroll. Following is the issue: we are on GB legislation but the company is a public sector company with staff of 4500 employees with employees scattered around

  • Can i use this cheap telly with apple tv?

    hi all - i was about to buy a soundbridge music streamer - mainly to play itunes through my hifi but for the extra £50 i am now thinking about an apple tv but i lack the approprite telly - i am about to buy one for the bedroom so would the one listed

  • Can I use my iphone 4 with Powerbook G4? It wont let me. Please help!!!

    Hi all! I've just opened my new iphone and tried to connect it to my powerbook g4 but it say that 'the iphone can not be used as it requires Mac OSX 10.5.8 or later'. My powerbook currently has 10.4.11. I've checked for updates but my Mac say I'm up

  • Boots to folder with exclamation mark or battery with exclamation mark

    recently purchased a used ipod 3g. i came with a dent in the uper left corner of the back of it. im not sure how old it is. it will (without ac pluged in) show the apple logo then turn off, when pluged in it will show either a battery with a exclamat

  • Essbase studio data loading

    Hi Friends, I need some help in cube deployment using Essbase studio and oracle as my source. I am trying to deploy a cube, my dimensions are loaded properly but data loading fails and gives following error. *"Cannot get async process state. Essbase