Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My forms are opening behind other open forms

Status
Not open for further replies.

Hmadyson

Programmer
Mar 14, 2001
202
US
I am using Access XP.

I have a fairly complex application. I am using normal, non modal forms.

Sometimes when a form opens, it is opening behind the active form.

The following code is used to launch a form

Note that my forms are Popup=No, Modal=No

DoCmd.OpenForm "FormName", acNormal, , "ID ='" & Me.txtID & "'", acFormPropertySettings, acWindowNormal
 
The active form which has the focus will always be in front. One possible way of controlling this is to hide all other forms until you require them.

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
How do I make sure that the newly open form has the focus? I need to keep them all open in this environment.
 
What are you using to open the form? clicking on a button?

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
yes, clicking some sort of button launches the code that opens another form. (docmd.openform)
 
Code:
  On Error GoTo Err_cmdReports_Click

  Dim stDocName As String
  Dim stLinkCriteria As String

  stDocName = "frmName"
  DoCmd.OpenForm stDocName, , , "ID ='" & Me.txtID & "'"

Exit_cmdReports_Click:
  Exit Sub

Err_cmdReports_Click:
  MsgBox Err.Description
  Resume Exit_cmdReports_Click
modal no
popup no

should open the form on top.
if not then there must be something which is switching the focus which remains on top.

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Thank you so much ProgramError, but I have tried all of your suggestions.

Can someone else please chime in with some help?
 
For anyone else looking for a solution to this, I think that this was occuring because Echo was off when I opened the form, then I would close another form, and a different one would be on top when the Echo went off.

I was able to fix this by using

Forms(XYZ).Setfocus after the close form and then I would see my forms on top again.
 
How are ya Hmadyson . . .

Is any form set to POpUp?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top