The following code checks if a file starts with te right name, after that in checks what the user wants. Most of the code works fine but if the users presses "Cancel", the messagebox re-appears.
Sub CheckBronbestand()
If Not Left(Dir(frmUpdate.txtOud), 5) = "Ap10" Then
result = MsgBox("Message line 1." & vbCrLf & vbCrLf & "Message line 2", vbOKCancel + vbQuestion, "Onjuist bestand")
If result = vbOK Then
frmUpdate.lblBron.Caption = Left(Dir(frmUpdate.txtOud), InStr(Dir(frmUpdate.txtOud), ".") - 1)
Exit Sub
ElseIf result = vbCancel Then
frmUpdate.txtOud.Text = ""
Exit Sub
End If
Else
frmUpdate.lblBron.Caption = Left(Dir(frmUpdate.txtOud), InStr(Dir(frmUpdate.txtOud), ".") - 1)
End If
End Sub
I can't see what the problem is, What can I do?
Thx for your answers, it put me on the right track
Just above the code I added: