View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pranav Vaidya Pranav Vaidya is offline
external usenet poster
 
Posts: 180
Default QueryClose problem

HI Keith

That's cool
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Keith74" wrote:

Ah, found a solution, adding a line to the query close event works

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)


Dim varResponse As Variant
If CloseMode = vbFormControlMenu Then
If blnChangedData = True Then
varResponse = MsgBox("You have changed data without
saving"
& Chr(13) & Chr(13) & _
"Do you wish to exit the form now?", vbYesNo)
If varResponse = vbNo Then
Exit Sub
End If
End If


Unload Me
set frmClient = nothing '<------new line
frmMain.Show
End If
End Sub