Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

How to quit from a loop ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
javiernews - 19 Dec 2006 23:04 GMT
Hi,

How to quit form the following loop after 15 seconds if Not success ???????

       Do While lngprgID = 0
           ' Quit after 15 seconds if No success
           DoEvents
           lngprgID = Shell(strCommand, vbNormalFocus)
       Loop

Thank you !

Javier
John Spencer - 20 Dec 2006 12:57 GMT
Try something like

Dim dteEndTime As Date
dteEndTime = DateAdd("s", 15, Now())

Do While lngPrgId = 0 And dteEndTime > Now()
  DoEvents
  lngPrgID = Shell(strCommand,vbNormalFocus
Loop

> Hi,
>
[quoted text clipped - 10 lines]
>
> Javier
BeWyched - 20 Dec 2006 13:14 GMT
Try:

StartTime = Now
> >        Do While lngprgID = 0
> >            ' Quit after 15 seconds if No success
> >            DoEvents
> >            lngprgID = Shell(strCommand, vbNormalFocus)
                If (Now - StartTime) * 24 * 3600 > 15 then Exit Sub
> >        Loop

BW

> > Hi,
> >
[quoted text clipped - 10 lines]
> >
> > Javier
javiernews - 20 Dec 2006 17:09 GMT
BW and John  !

Thank you !!
Both ways are working good.

Bye
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.