467,166 Members | 1,130 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,166 developers. It's quick & easy.

work on 2 pop up forms

64KB
If u have 2 pop up forms opened, a large one and a smaller one, is there any way they can be both worked on and the smaller one always stay on top? Just like when u work in a form in design view in access, the property sheet is always on top and u can work on both. thanks
Dec 3 '20 #1

✓ answered by twinnyfo

Neruda,

You can add the code that runs on the OnLoad Event anywhere in your form. There is nothing that says it must be in the OnLoad event.

Just make it a public sub/function and refer to it from the other form when you need to:

Expand|Select|Wrap|Line Numbers
  1. Call Forms![FormName].[Sub/FunctionName]
Hope that hepps!

  • viewed: 4951
Share:
10 Replies
Expert 1GB
Neruda,
Must they be separate forms, or can one be a sub-form of the other?
Dec 3 '20 #2
64KB
they are 2 separate pop up forms, the smaller popup opens with a button within a subform of the large form
Dec 3 '20 #3
Expert 1GB
Just a guess here, but maybe you could something with the OnFocus of the bigger form. When that form gains the focus you fire an event in the subform that puts the focus on an object in the subform and then then the same event in the main form puts the focus back on itself. So if you switch to another program, both forms might go to the background but when you come back to the main form you will make both forms on top any other open windows.

Jim
Dec 3 '20 #4
isladogs
Expert 128KB
Sorry but if both forms are popups, there shouldn't be a problem

If the smaller popup is opened by clicking a button on the larger popup, it should always be on top.

If the second form was already open when the first form is opened, it will go to the back of the 'z-order'. However clicking the button on the first form will restore it to the top.

Very basic example attached.

Of course, clicking on the larger form will restore focus to that and hide the smaller form if located in the same place. But you can click the button again ...
OR just move the smaller form to one side.
OR change the larger form so it isn't a popup!
Attached Files
File Type: zip TwoPopupsExample.zip (18.4 KB, 13 views)
Dec 3 '20 #5
64KB
how about hide or close the yellow form when it goes to the back?
Dec 13 '20 #6
isladogs
Expert 128KB
You can certainly hide or close the smaller (yellow) form when it goes to the back, but why bother? It is effectively hidden anyway
Dec 14 '20 #7
64KB
I need to close it because I want the formLoad event to run again every time the yellow form is closed, how do you close the form just by focusing on the large form, tried with lost focus event but did not work
Thanks
Dec 15 '20 #8
isladogs
Expert 128KB
One simple method is to add code to the Detail_Click event of the large (blue) form which closes the smaller (yellow) form.
To show when the yellow form is being reopened, I've added a message to the Form_Load event of that form.

Adapt as appropriate to suit your requirements.
Attached Files
File Type: zip TwoPopupsExample_v2.zip (21.3 KB, 6 views)
Dec 15 '20 #9
twinnyfo
Expert Mod 2GB
Neruda,

You can add the code that runs on the OnLoad Event anywhere in your form. There is nothing that says it must be in the OnLoad event.

Just make it a public sub/function and refer to it from the other form when you need to:

Expand|Select|Wrap|Line Numbers
  1. Call Forms![FormName].[Sub/FunctionName]
Hope that hepps!
Dec 15 '20 #10
64KB
Thank u for your answers, in the end I have done what u suggested and also added this code to hide the smaller form once it loses focus

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.  
  3. ' error trap is used to process situations when not a form is clicked outside of the popup form
  4. On Error GoTo NotForm:
  5.  
  6.     If Me.Name = Screen.ActiveForm.Name Then Exit Sub
  7.  
  8. NotForm:
  9.     Me.TimerInterval = 0
  10.     Me.Visible = False
  11.  
  12. End Sub
3 Weeks Ago #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by KK | last post: by
3 posts views Thread by Leon Slutzkin | last post: by
2 posts views Thread by justdo@alumni.ice.ntnu.edu.tw | last post: by
21 posts views Thread by Dan Tallent | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.