Hi All,
Ive got a bit of a problem here that has got me stumped.
Bascially I have a piece of code here that sets up a slideshow in a picture box and it runs beautifully, however I cant make it stop during the show, it has to run all the way through.
what I tried to do to stop the slideshow running, was to set up a Public Integer call intbreak and on starting the slideshow I set intbreak = 0
Then as the slide show is running, there is another button on the form that sets the public variable to 1, I then tried puttting in an "if Intbreak=1 statement", but it does not work and I get a "wend with no while" error, it seems that if I put an if statement in the middle it gets confused.
Anybody any ideas on how I can quit this routine on a button puch while its running.
Any help would be most gratfully recieved.
many thanks
James
The Code on the Slideshow Button:-
Ive got a bit of a problem here that has got me stumped.
Bascially I have a piece of code here that sets up a slideshow in a picture box and it runs beautifully, however I cant make it stop during the show, it has to run all the way through.
what I tried to do to stop the slideshow running, was to set up a Public Integer call intbreak and on starting the slideshow I set intbreak = 0
Then as the slide show is running, there is another button on the form that sets the public variable to 1, I then tried puttting in an "if Intbreak=1 statement", but it does not work and I get a "wend with no while" error, it seems that if I put an if statement in the middle it gets confused.
Anybody any ideas on how I can quit this routine on a button puch while its running.
Any help would be most gratfully recieved.
many thanks
James
The Code on the Slideshow Button:-
Code:
Dim X As Integer
Dim intbreak As Integer
intbreak = 0
Dim fs1
Set fs1 = CreateObject("Scripting.filesystemobject")
Dim ab As String
abloc = Sysdrive & ":" & Sysdir & Collection 'Public Variables to get basic path
Title = "Speed Settings" ' Set title.
Defvalue = "400" ' Set default return value.
numx = InputBox(Msg, Title, Defvalue) ' Get user input.
Dim rst As New ADODB.Recordset
rst.Open "IssuesAlpha", CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdTable
While Not rst.EOF
aax = rst![F1] ' Get record from table
ab = Len(aax) ' get length of string
ab1 = Left(aax, ab - 4) 'remove the extension of the filename
ab2 = abloc & "\coversthumb\" & ab1 & ".jpg" 'add .jpg to the filename
If fs1.FileExists(ab2) = True Then
Image1.Picture = ab2 ' set the picture for the slideshow
End If
rst.MoveNext ' get the next filename
For X = 1 To numx ' delay to allow picture to stay on screen as set above
DoEvents
Next X
'If Intbreak = 1 Then ' Tried this, but it did not work.
'Exit Sub
'End If
Wend
rst.Close