Forms not opening in Modal/Dialog mode

EternalMyrtle

I'm still alive
Local time
Yesterday, 22:50
Joined
May 10, 2013
Messages
533
Hello,

I am experiencing an issue with my forms that seems to have cropped up out of nowhere: the forms are not opening in modal/dialog mode when they should be.

  1. The forms' pop-up and modal properties are set to "yes"
  2. The code specifies to open Dialog so, for example:

Code:
DoCmd.OpenForm "frmCompanies", , , , , acDialog

Yet, the form opens behind the other form (which, incidentally, is also set to be pop up and modal in the form properties--is that the problem? If so, why wasn't this an issue until now?).

I am not sure what to do as it is a pretty big deal for data entry reasons.

Can anyone offer any solutions? I have Access 2007.

Thank you
 
If the property is already set in the form properties then there's no need adding that argument in the OpenForm command.

Have you tried taking it out?
 
Yes, I put the "acDialog" part of the code in after the problem cropped up hoping it would help.

It is also happening when a new record needs to be created using the "List items edit form" property which does not rely on code to open the form. This is actually when the situation is most problematic.

Ugh :banghead:!
 
Have you tested it on a brand new form with nothing in it?
 
Ok, that works. So what does this mean? It is something else in the form causing the problem?
 
A corrupt form perhaps. Create a new one and copy the code and controls across. Or export to a new db, and import back into your current db. My preference would be the former.
 
Ok, so in the process of doing what you suggested I found a line of code to a module function I had written that should have been deleted. I deleted it and now the pop up appears to be working properly. I am fairly sure that is what was causing the problem.

Thanks again for your help!
 
Yes, I always compile it :) For the record, there was nothing technically *wrong* with the code that the compile would find. Because it looped through the active objects, I think it was causing the error to occur.

I wrote the code to put into my forms' On Close event. It checks if any forms besides the active screen are open and opens the main menu if none are. Another forum member suggested to simply leave the main form open in the background instead. It was a simpler solution that had less potential to cause problems ;)
 
So I did that instead but forgot to remove the offending code from some of my forms :o
 
So was that function trying to open the form in a different mode?
And just for the record when you say you compile it, you don't mean Compact & Repair right?
 
I mean going into the code window (Alt + f11) going up to Debug and choosing "Compile".
 
Ha ha, you never know :D

The code had nothing to do with the form mode and I am kind of surprised it caused the problem but seeing as removing it worked, I am not going to analyze exactly what happened just keep moving forward hoping the problem is solved for real.

This was the code:

Code:
Public Function OpenMainMenu()
Dim frm As AccessObject
Dim blnLoaded As Boolean

With CurrentData
    
With CurrentProject
   ' "Forms"
   
   For Each frm In .AllForms
   If frm.Name <> Screen.ActiveForm.Name  Then
       If frm.IsLoaded = True Then
       blnLoaded = True
       Exit Function

       
       End If
       End If
       
         Next frm
         
DoCmd.OpenForm "frmMainMenuBDPR"

  
End With
End With



End Function
 
At this point I would be inclined to move all your objects and code into a new db. It helps to get rid of any "junk" that a Compact/Repair couldn't remove.
 

Users who are viewing this thread

Back
Top Bottom