|
-
Nov 22nd, 2002, 05:35 PM
#1
Thread Starter
Fanatic Member
Object was unloaded error
Code:
Private Sub cmdLoadChapters_Click()
Load frmChapters
frmSplash.Hide
Unload Me
End Sub
In the frmChapters Form_Load
Me.cdbPath.ShowOpen
FullPath = Me.cdbPath.filename
If Len(Dir(FullPath)) = 0 Or Len(FullPath) = 0 Then Unload Me: Exit Sub
When I cancel out of the cdb on the second form, (triggering the Unload Me in the last line) how come I get an 'Object was Unloaded' error from the first line of the first form that loaded it?
-
Nov 22nd, 2002, 05:38 PM
#2
Frenzied Member
specify the form name you want to unload rather than unload me
I think after you open the other form, the Unload Me statement actually unloads that form, not the form you want
-
Nov 22nd, 2002, 05:40 PM
#3
Thread Starter
Fanatic Member
Nope, I tried it, still the same error.
-
Nov 22nd, 2002, 06:05 PM
#4
Frenzied Member
Ok, try unloading the form in Form_Activate instead
So do something like this
VB Code:
'In frmChapters
Private blnExit as Boolean
Private Sub Form_Load()
blnExit = False
cdbPath.ShowOpen
FullPath = Me.cdbPath.FileName
If Len(Dir(FullPath)) = 0 Or Len(FullPath) = 0 Then
'Exit this form!!!
blnExit = True
End If
End Sub
Private Sub Form_Activate()
If blnExit = True Then
Unload Me
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmChapters = Nothing
End Sub
'**************************************************
'In frmSplash
Private Sub cmdLoadChapters_Click()
Unload frmSplash
frmChapters.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmSplash = Nothing
End Sub
-
Nov 22nd, 2002, 06:28 PM
#5
Thread Starter
Fanatic Member
Well, I just got sidetracked into something else so I won't be able to try it out and tell you if it works for a little bit, but I did want to thank you for your help . . .
I bookmarked the thread and shall return.
-
Nov 22nd, 2002, 07:29 PM
#6
Frenzied Member
It does work i tried it myself :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|