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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initiating DoEvents

Status
Not open for further replies.

mmatsumura

Technical User
Nov 21, 2001
40
US
Hi all,

Before I begin let me say a) this is the first time I've visited the site and am very impressed and b) the information being posted is excellent. Good job to all who have contributed!

Okay... The problem I'm facing is that the execution of an event seems to not yeild itself by calling the DoEvents function. Within a module I just prepared, I wish to run a Shell function allowing the program to initiate and execute a batch process. The batch file I've referred to calls a DOS application to run which ultimately generates a text file for import. Below is a section of the module mentioned:

rsPhase1.Close
rsPhase2.Close
Shell "C:\Mike\Test.bat", vbHide
DoEvents
DoCmd.TransferText acImportFixed, "Mike Import Specification", "MikeTest", "C:\Mike\Data.txt", False

I have been beating myself over this one but just cannot come up with a solution.

Any comments/suggestions would be appriciated!
 
Let me guess, it doesn't allow enough time for the batch file to process before attempting to execute the import?
 
I know this might sound crude but what you could do is stick a loop into the place of the Do events and say

x=1
Do while x=1
myfile = Dir(pathname&filename)
if len(myfile) > 0 then
x=0
end if
Loop

In essence what this is doing is checking continuously whether the file exists or not and it keeps looping until such time as it finds the file. You could also stick a timer in there to say that if you reach a certain time without having found it then you could exit the loop as well. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top