Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21237

[RESOLVED] form MDi Child disappears after canceling the exit in MDI

$
0
0
i have a MdiMain and MdiChild
i put a code that only if the mdichild window is closed then i can exit the program however
when i try to exit the mdichild from the MdiMain the window disappears
this is the code that i entered
Code:

Private Sub MDIForm_QueryUnload(cancel As Integer, UnloadMode As Integer)
If FrmExpenses Is ActiveForm Then
 MsgBox "you need to close this window before you can exit the program", vbExclamation
 Exit Sub
 End If

If FrmInventory Is ActiveForm Then
 MsgBox "יyou need to close this window before you can exit the program", vbExclamation
 Exit Sub
 End If

  If MsgBox("Exit?", vbExclamation + vbDefaultButton2 + vbYesNo, "") = vbNo Then
        cancel = True
      Exit Sub
  Else
 Dim TimeDiff As Long
Dim StartDate As Date
Dim EndDate As Date
Dim rsL As ADODB.Recordset
Set rsL = New ADODB.Recordset
rsL.Open "Select LogIn from Logs where logid=" & ULog, CN, adOpenForwardOnly, adLockOptimistic
If rsL.EOF Then
    MsgBox "no entrance found"
Else
      StartDate = rsL(0)
      EndDate = Time
    TimeDiff = DateDiff("n", StartDate, EndDate)
    CN.Execute "Update Logs set Logout=#" & Format(EndDate, "HH:MM:SS") & "#, LogTotal=" & TimeDiff & " where logid=" & ULog
End If
End If
  End
End Sub


Viewing all articles
Browse latest Browse all 21237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>