Problem with form opening by double click

skp

Registered User.
Local time
Yesterday, 16:03
Joined
Feb 28, 2011
Messages
21
I have a form called 'MainOpen' which is basically just a list of all the records in the database. I have it set up so when you double click the name field of the list a new form will open with more detailed info about that specific record. For some reason when you double click the name the new form opens behind the 'MainOpen' form which then you have to minimize that form to click the new form and bring it to the front. Why will it not open in front of the 'MainOpen' form?

Here is the code I have for the double click event on the name(dba) field:

Private Sub DBA_DblClick(Cancel As Integer)
On Error GoTo Err_cmdEdit_Click
DoCmd.OpenForm "MainOpen", , , "RecNo = " & Me!RecNo
Exit_cmdEdit_Click:
Exit Sub
Err_cmdEdit_Click:
MsgBox Err.Description
Resume Exit_cmdEdit_Click
End Sub
 
I've seen this before, but I don't know what causes it. I simply made the new form open in modal to fix it.
 
Only time I've seen this is if the first Form has its Popup Property set to Yes.

Either set the Main Form's Popup Property to No or the second Form's Popup Property to Yes.

Opening the second Form thru code in Modal will do the same thing, as speakers 86 said, because this also opens the Form with Popup set to Yes.

Linq ;0)>
 
I basically set all my forms to pop up. Usually from a pop up form, if you open another pop up form, the new one will be on top. I developed a db on my laptop where this was happening as expected. Then I moved to a different computer running Vista and Access 2007 and all of a sudden the secondary form opened and immediately ducked behind the first form. As I said that did not happen on my laptop. Whatever the issue is, I think the OP is experiencing the same thing.

edit-Do you think this could be fixed using an API call to grab the handle and bring it to the front?
 
Either set the Main Form's Popup Property to No or the second Form's Popup Property to Yes.

Linq ;0)>
Or give it a little bit of time to process the Double Click event:
Code:
Private Sub DBA_DblClick(Cancel As Integer)
On Error GoTo Err_cmdEdit_Click

    Me.TimerInterval = 100
    
Exit_cmdEdit_Click:
    Exit Sub
Err_cmdEdit_Click:
    MsgBox Err.Description
    Resume Exit_cmdEdit_Click
End Sub


Private Sub Form_[COLOR=Red]Timer[/COLOR]()
    Me.TimerInterval = 0
    DoCmd.OpenForm "MainOpen", , , "RecNo = " & Me!RecNo
End Sub
 
I'm intrigued! How does timing effect whether the second form opens in front of the first or behind it?
 
I've found there is an issue when using Double Click events. I don't know what the root cause is but I suspect that it seems to take precedence over most events. So the timer kind of breaks this stronghold and allows other events to run as normal.

Give it a quick try.
 
Interesting! Something to keep in mind! I know Double-Click can be dicey, at times, especially trying to use it on a Command Button, which I never do, but have never experienced this kind of problem myself, when using it for this purpose.

Linq ;0)>
 
Well that is good to know. Just shows how much faster my laptop is then the work computers too!
 

Users who are viewing this thread

Back
Top Bottom