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

controlling order of execution

Status
Not open for further replies.

KMdouglas

MIS
Jan 17, 2000
11
US
I have an on click event the calls three separate subroutines, subA subB and subC. I need to make sure that subA ends before subB beging, and subB ends before subC begins. Currently, when running the on click event all three subroutines run simultaneously with disasterous results. Does anyone know of any way to make sure that the subroutines are called only after the previous one finishes?

I looked into using a timer already, but this will not work because there is no way of telling how long each sub will last.

Thanks



Kevin M. Douglas
kevin@easternresearch.com
 
Why not use a master macro with the 3 subs in that.

e.g.

Sub master()
Call suba
Call subb
Call subc
End sub
 
Here is the full code for the event

============================================================
Option Compare Database

-----------------------------------------------------------
''Subroutine to create the pipe delim file from the 9000 using text box input
Public Sub createpsv(client_name, study_code)

Call Shell("rsh server1 -l kevind -n cd /qc2/projects/" & client_name & "/" & study_code & _
"; /ers/scripts/perl/makecsv.pl onecol")


End Sub
-----------------------------------------------------------

''Subroutine to create the FTP Script using the text box input
Public Sub makeftp(client_name, study_code)

Open "c:\temp\ftpscript" For Output As #1

Print #1, "open ftp.sever1.com"
Print #1, "user"
Print #1, "password"
Print #1, "get /qc2/projects/" & client_name & "/" & study_code & "/onecol.psv c:\temp\onecol.psv"
Print #1, "quit"

Close #1

End Sub

-----------------------------------------------------------
''Subroutine to call the ftp script
Public Sub runftp()

Call Shell("ftp -s:C:\temp\ftpscript")

End Sub


-----------------------------------------------------------
Private Sub cmdGo_Click()


Dim FTPScript As String
Dim Client, Study As String

txtClientName.SetFocus
Client = txtClientName.Text

txtStudyCode.SetFocus
Study = txtStudyCode.Text

''CREATE PSV FILE ON THE 9000
Call createpsv(Client, Study)

''CREATE FTP SCRIPT

Call makeftp(Client, Study)

''RUN THE FTP SCRIPT
Call runftp

end sub
------------------------------------------------------------



Kevin M. Douglas
kevin@easternresearch.com
 
Kevin my way will ensure that subA has been completed before SubB starts etc.
 
Try something like this in createpsv():
Set oShell = CreateObject("WSCript.Shell")
rc = oShell("rsh server1 -l kevind -n cd /qc2/projects/" & client_name & "/" & study_code & _
"; /ers/scripts/perl/makecsv.pl onecol", 1, True)
And something similar in runftp()

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top