B
Bert
I have 2 frames on a dialogbox. When leaving the first
frame there is a check whether the variable
txtHoofdopsteller is empty or not. The frame must not been
abandoned when the named variable is empty unless......
there was a click on the commandbutten Cancel.
When there was a click on the commandbutton Cancel, a
check takes place whether is is allowed to leave the
frame. In the code of the frame I try to check if there
was a click on Cancel.
This is my code:
Private Sub fraOmslagpagina_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
'Obligate input of this field
If frmPvAconops.cmdAnnuleren <> 0 Then
If Trim(Me.txtHoofdopsteller) = "" Then
Cancel = True
MsgBox "Vul de naam van de opsteller in. Je kunt
hem later weer wijzigen."
Exit Sub
End If
Else
Unload Me
ActiveDocument.Close SaveChanges = False
End
End If
End Sub
If there is a click on Cancel, the dialogbox unloads and
the document closes (=wanted result). But, when the
variables are filled in and the frame is left, the
dialogbox also unloads and the document closes (= not
wanted result!).
What is wrong in my code?
Thanks for your help.
Greets,
Bert
frame there is a check whether the variable
txtHoofdopsteller is empty or not. The frame must not been
abandoned when the named variable is empty unless......
there was a click on the commandbutten Cancel.
When there was a click on the commandbutton Cancel, a
check takes place whether is is allowed to leave the
frame. In the code of the frame I try to check if there
was a click on Cancel.
This is my code:
Private Sub fraOmslagpagina_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
'Obligate input of this field
If frmPvAconops.cmdAnnuleren <> 0 Then
If Trim(Me.txtHoofdopsteller) = "" Then
Cancel = True
MsgBox "Vul de naam van de opsteller in. Je kunt
hem later weer wijzigen."
Exit Sub
End If
Else
Unload Me
ActiveDocument.Close SaveChanges = False
End
End If
End Sub
If there is a click on Cancel, the dialogbox unloads and
the document closes (=wanted result). But, when the
variables are filled in and the frame is left, the
dialogbox also unloads and the document closes (= not
wanted result!).
What is wrong in my code?
Thanks for your help.
Greets,
Bert