Shell command only works in Debug mode

Posted on 2011-10-27
Last Modified: 2012-05-12
This is driving me a little stir crazy.
I have written a function which executes a shell command to create a tasklist file. It appears the only way that it will work is if I actually step through the command in debug mode. Not sure what I'm doing wrong here.
I've attached a small app to illustrate the problem.
When you open the app, the form has a 'checkbox' labelled "Step through the Shell command". If you click the 'Load the task list' command button, while the checkbox is checked, the function will stop just prior to where the Shell command is executed. If you press CTRL+8 twice to actually step through the Shell command, the text file is created.
Now try clicking the 'Load the task list' command button, while the checkbox is not checked, an error is generated because the file isn't created.
Can anyone explain to me what is happening here and why?

- It's really late and I'm going to try to get some sleep for a few hours. I'll check on this when I get up.
Question by:shambalad
    LVL 39

    Accepted Solution

    I think you should wait for result of command. task need some time to prepare csv file.
    May be this link can help:
    LVL 7

    Author Closing Comment

    Thank you very much.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now