Msgbox (1 Viewer)

seany

Registered User.
Local time
Today, 20:18
Joined
Sep 1, 2003
Messages
53
When you click Ok on the msgbox i what it to repeat the process that it has just done.


Private Sub Form_Current()

Dim WholeSpec As String
Dim Filefolder As String
Dim Filename As String
Dim s As String
Dim i As Integer



If IsNull(Me.txtname) Then
Me.Image.Picture = "" 'No image
Else:

WholeSpec = Me.txtname

Filefolder = Mid(WholeSpec, 1, InStrRev(WholeSpec, "\") - 1)
Filename = Mid(WholeSpec, InStrRev(WholeSpec, "\") + 1)
If (Left(Me.txtname, 1) = "D") Or (Left(Me.txtname, 1) = "E") Then

With Application.FileSearch 'Searchs D drive

.LookIn = "D" & Right(Filefolder, Len(Filefolder) - 1)
.SearchSubFolders = False
.Filename = Filename
.MatchTextExactly = True
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
If Len(Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1)) = Len(Filename) Then
Me.Image.Picture = .FoundFiles(i)
End If
Next
End If
s = .FoundFiles.Count
End With

If s = 0 Then

With Application.FileSearch 'Searchs E drive

.LookIn = "E" & Right(Filefolder, Len(Filefolder) - 1)
.SearchSubFolders = False
.Filename = Filename
.MatchTextExactly = True
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
If Len(Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1)) = Len(Filename) Then
Me.Image.Picture = .FoundFiles(i)
End If
Next
End If
t = .FoundFiles.Count
If t = 0 Then

Dim reply As Integer

reply = MsgBox("Please insert picture CD", vbOKCancel, "Please insert picture CD")
'2 = Cancel; 1 = Ok;
If reply = 2 Then
Me.Image.Picture = ""
Else
If reply = 1 Then ' I what it to go up to the top line

End If
End If
End With
End If
Else: Me.Image.Picture = Me.txtname
End If
End If

End Sub
 

namliam

The Mailman - AWF VIP
Local time
Today, 21:18
Joined
Aug 11, 2003
Messages
11,695
If reply = 1 Then ' I what it to go up to the top line
Redo the module?

Call Form_Current

Will restart the same module (recursive)

Regards

The Mailman
 

Mile-O

Back once again...
Local time
Today, 20:18
Joined
Dec 10, 2002
Messages
11,316
Or:


Code:
Do Until reply = 1
    [i][code][/i]
Loop


if you dimension reply at the top of the procedure.
 

Users who are viewing this thread

Top Bottom