IDoWindows
Programmer
I’ve got a strange situation here, and I wanted to see if it rings any bells with anyone. When I run my main form code from within VB, with no breakpoints, I get the error “Can’t show non-modal form when a modal form is displayed.” Debugging at this point reveals the offending "form show" some 40 lines later. Like this:
If mvAccountType = "Admin" Then
frmEnterSchool.Show vbModal, Me
End If
.
.
.
frmStudents.Show
Now, if I put a msgbox just before the "If", forcing the code to stop execution until I click “OK”, then it continues and executes as expected, with the frmEnterSchool form vbmodal and holding up further processing until frmEnterSchool unloads.
Equally as curious, when I remove the msgbox and put in a simple breakpoint to pause processing at the "If", to verify that I am logged in with “Admin” account type, then press F5 to continue processing, the modal frmEnterSchool behaves properly, also. Same results using the “run to cursor” debugging tool, with cursor on the "If"… It’s a puzzler.
If mvAccountType = "Admin" Then
frmEnterSchool.Show vbModal, Me
End If
.
.
.
frmStudents.Show
Now, if I put a msgbox just before the "If", forcing the code to stop execution until I click “OK”, then it continues and executes as expected, with the frmEnterSchool form vbmodal and holding up further processing until frmEnterSchool unloads.
Equally as curious, when I remove the msgbox and put in a simple breakpoint to pause processing at the "If", to verify that I am logged in with “Admin” account type, then press F5 to continue processing, the modal frmEnterSchool behaves properly, also. Same results using the “run to cursor” debugging tool, with cursor on the "If"… It’s a puzzler.