Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Execution sequence

Status
Not open for further replies.

jtlawn

Programmer
Mar 23, 2000
15
0
0
US
My job initially empty's out my access table, next it executes a job to download data from our mainframe to a text file.&nbsp;&nbsp;Then it imports the text file into my access table, runs a query and exports an excel spreadsheet.&nbsp;&nbsp;<br><br>My problem is the job clears the table and executes my download job, while this is happening my job continues on and imports my text file, since it exist, from the last time the job ran, then runs the query and exports the excel spreadsheet.<br><br>I do not want the job to continue until my download is complete and my new text file is created.<br><br><b>Here is my code:</b><br><br>Dim JobPath As String<br>Dim Retval As Variant<br><br>DoCmd.OpenTable &quot;Career&quot;, acNormal, acEdit<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.RunCommand acCmdSelectAllRecords<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.RunCommand acCmdDeleteRecord<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>JobPath = &quot;D:\das\daszcomm.exe d:\das\work\career.as /q&quot;<br>Retval = Shell(JobPath)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>DoCmd.TransferText acImportDelim, &quot;&quot;, &quot;career&quot;, &quot;d:\das\work\career.txt&quot;, True, &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.SetWarnings False<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OpenQuery &quot;careercompque&quot;, acNormal, acReadOnly<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>DoCmd.TransferSpreadsheet acExport, 8, &quot;careercompque&quot;, &quot;d:/das/work/careercomp.xls&quot;, True, &quot;&quot;<br><br>Is there a way I can do this.<br><br>Thank You <p> Joe Lawn<br><a href=mailto:jtlawn@hotmail.com>jtlawn@hotmail.com</a><br><a href= > </a><br>
 
Search this forum for the word &quot;WaitForSingleObject&quot;, and there are some posts I responded to asking the same thing.&nbsp;&nbsp;I'm at a different machine and don't have the exact code here or else I'd post it again...sorry :).&nbsp;&nbsp;You'll probably find several matches on that, but all will probably have the same bit of code to run following the shell() stmt.&nbsp;&nbsp;It's just 3 lines, with a couple of api declares.<br>--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top