473,378 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to make a form popup - sometimes!

204 128KB
I have a form, Form11, with a subform subfrm_ATI located within it. Neither form nor subform is popup or modal.

I have another form, Form67, which is Popup and modal.

I would like Form67 to be able (via a VBA event procedure) to open the same subform (subfrm_ATI), this time as a popup form, so that I can resize it and locate it just below the Form67. But I don't want to interfere with the operation of Form11 and its subform.

Is this possible? I have tried several combinations of options but I can't get it right.
Dec 17 '20 #1

✓ answered by isladogs

OK...It is possible but only with some fairly convoluted code.
The attached example shows how it can be done.
The code I used is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdPopup_Click()
  2.  
  3.     Application.Echo False
  4.     If Me.cmdPopup.Caption = "Set Popup True" Then
  5.         DoCmd.OpenForm "Form1", acDesign
  6.         Forms!Form1.PopUp = True
  7.         DoCmd.OpenForm "form1", acNormal
  8.         Forms!Form1.cmdPopup.Caption = "Set Popup False"
  9.         Forms!Form1.lblPopup.Caption = "I AM a Popup Form"
  10.     Else
  11.         DoCmd.OpenForm "Form1", acDesign
  12.         Forms!Form1.PopUp = False
  13.         DoCmd.OpenForm "form1", acNormal
  14.         Forms!Form1.cmdPopup.Caption = "Set Popup True"
  15.         Forms!Form1.lblPopup.Caption = "I am NOT a Popup Form"
  16.     End If
  17.     Application.Echo True
  18.  
  19. End Sub
  20.  
  21. Private Sub Form_Load()
  22. If Me.PopUp = True Then
  23.     Me.cmdPopup.Caption = "Set Popup False"
  24.     Me.lblPopup.Caption = "I AM a Popup Form"
  25. Else
  26.     Me.cmdPopup.Caption = "Set Popup True"
  27.     Me.lblPopup.Caption = "I am NOT a Popup Form"
  28. End If
  29. End Sub
Drag the form up so the title bar is over/under the ribbon to confirm the current state.

Note that the Me. notation won't work after changing to/from design view

I haven't tried it with a subform but the same ideas should work.
However this may be one time where it is easier to just have two identical copies of the form, one popup and the other not.

17 1942
isladogs
455 Expert Mod 256MB
Whether done using code or via the property sheet, you can only change the popup status of a form when in design view. So I think the answer is no.
Dec 17 '20 #2
Petrol
204 128KB
"No" as in "not possible"?
The OpenForm documentation says there is an option to open the form in design view, so perhaps there might be a way there??
But I'm not sure how one would go about it.
Dec 17 '20 #3
isladogs
455 Expert Mod 256MB
OK...It is possible but only with some fairly convoluted code.
The attached example shows how it can be done.
The code I used is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdPopup_Click()
  2.  
  3.     Application.Echo False
  4.     If Me.cmdPopup.Caption = "Set Popup True" Then
  5.         DoCmd.OpenForm "Form1", acDesign
  6.         Forms!Form1.PopUp = True
  7.         DoCmd.OpenForm "form1", acNormal
  8.         Forms!Form1.cmdPopup.Caption = "Set Popup False"
  9.         Forms!Form1.lblPopup.Caption = "I AM a Popup Form"
  10.     Else
  11.         DoCmd.OpenForm "Form1", acDesign
  12.         Forms!Form1.PopUp = False
  13.         DoCmd.OpenForm "form1", acNormal
  14.         Forms!Form1.cmdPopup.Caption = "Set Popup True"
  15.         Forms!Form1.lblPopup.Caption = "I am NOT a Popup Form"
  16.     End If
  17.     Application.Echo True
  18.  
  19. End Sub
  20.  
  21. Private Sub Form_Load()
  22. If Me.PopUp = True Then
  23.     Me.cmdPopup.Caption = "Set Popup False"
  24.     Me.lblPopup.Caption = "I AM a Popup Form"
  25. Else
  26.     Me.cmdPopup.Caption = "Set Popup True"
  27.     Me.lblPopup.Caption = "I am NOT a Popup Form"
  28. End If
  29. End Sub
Drag the form up so the title bar is over/under the ribbon to confirm the current state.

Note that the Me. notation won't work after changing to/from design view

I haven't tried it with a subform but the same ideas should work.
However this may be one time where it is easier to just have two identical copies of the form, one popup and the other not.
Attached Files
File Type: zip PopupToggle.zip (27.2 KB, 38 views)
Dec 17 '20 #4
Petrol
204 128KB
Ah, that's excellent. Thank you.
And I take your point about making a duplicate copy of the subform popup. I don't expect the subform to be changed in future, so that may be the best approach. But I'm grateful to know how to make the change programmatically.
Dec 17 '20 #5
isladogs
455 Expert Mod 256MB
Thank you for asking the question..
Until today I had just accepted the need to change to design view in order to toggle popup (or modal) status.
It was your question that triggered me to test the code and check it actually worked. As a proof of concept, I'm pleased to have done so but I'm not sure I will ever have a reason to use it myself.
Dec 17 '20 #6
twinnyfo
3,653 Expert Mod 2GB
BTW, Modal property can be changed whilst the form is currently open.

I have used that from time to time with much success.
Dec 17 '20 #7
isladogs
455 Expert Mod 256MB
@twinnyfo
Why would you ever need to make an open form modal or not?
I can't think of any possible reason for doing so.
Dec 17 '20 #8
twinnyfo
3,653 Expert Mod 2GB
Good question, IslaDogs!!

Let's say you have a modal, popup form with the DB window hidden. Then you want to display a report (not print it). There is no way to do that without displaying the DB window. There is no way to display the DB window with a popup form (because the form will stay on top). If I remember correctly, you also cannot hide a modal form (or something to that effect).

So, I click my button to open the report. It de-modalizes the form, hides it, displays the DB window, opens/displays the report and maximizes said report.

When the Report closes, it un-does everything in reverse order. Viola! Violin and Violets, too! That is my application of it. But, it could be used in some of the other questions floating around here lately concerning switching around betwixt various popup forms.

Hope that hepps!
Dec 17 '20 #9
Petrol
204 128KB
Let me guess: you open a form non-modal, but something the user enters means they really can';t go away till they complete the process?

Or you open it modal, but something they enter indicates a need to show them a report?
Dec 17 '20 #10
Petrol
204 128KB
Oh, I typed my response before I saw Twinnyfo's explanation. Sorry!
Dec 17 '20 #11
twinnyfo
3,653 Expert Mod 2GB
Yes - definitely the latter!

In fact, I ALWAYS open all forms in Modal and Popup mode (and recommend you do the same)--as well as always hide the DB window. I always prevent "accidental" access to anything grubby little fingers might want to look at....
Dec 17 '20 #12
isladogs
455 Expert Mod 256MB
Hi twinnyfo
Thanks for the explanation though I'm not sure I agree with all of it. Having said that I rarely bother with modal forms.
I have an example app that covers almost all of the possible ways of working with forms and reports whilst the Access application interface is hidden.
It would be much easier to provide a link but I'm not allowed to do so here. So please do a Google search for "control application interface mendip data systems". Hopefully the First 'hit' will take you to the example app.
Dec 17 '20 #13
twinnyfo
3,653 Expert Mod 2GB
I will take a look.

Admittedly, my usage is overly clunky, but has worked very well for many years. I am always open to better ways to do things.

Thanks!
Dec 17 '20 #14
Petrol
204 128KB
Well you live and learn!
Well, at least I do, anyway.
If necessary I can ask this as a separate question, but would any of those things in your sample database solve another problem I have? A user complains that some of the fields in my forms and reports are too small to show the data in them. (Yes, I know he can scroll sideways, but ...). But on my computer they all fit perfectly, and if I reduce the font size they look ridiculously small. Why would different monitors scale the textbox etc sizes differently from the font size? Can I fix it?
Dec 17 '20 #15
isladogs
455 Expert Mod 256MB
I use automatic form resizing (AFR) in all my commercial apps and many of my example apps. The code to do so is included in the example app I mentioned earlier. However I have an extended article that explains this feature in detail. Do a Google search for 'Automatic form resizing Mendip Data Systems'
Dec 17 '20 #16
Petrol
204 128KB
That does look interesting, though i didn't understand all the stuff about default form sizes etc, which I guess I would need to get my head around to use it. Unfortunately my application is already developed (on a 1920x1080 screen) with about 70 forms and 40+ reports, and sadly, I don't think I can re-do them all! Also, I use tabbed documents instead of overlapping windows, and popup forms :(
Dec 18 '20 #17
isladogs
455 Expert Mod 256MB
AFR is most suitable for apps where it is planned in for use from the start. Having said that you could always try it out on new forms and reports.
However, as my article makes clear, it works equally well with both tabbed documents and overlapping window displays, and whether or not forms are popups.
Dec 18 '20 #18

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

Similar topics

6
by: Cc | last post by:
hi, how do I make form background colour transparent when I set border style to none?
3
by: Prasun | last post by:
Hello: Is there a way from me to make a second form(a DataGrid) pop-up when the user presses a button on a message box. How do I do this? Thank You Prasun
4
by: amerar | last post by:
Hi Everyone, I am very new to this, so I'm hoping someone can help. I have a form with buttons that a user can click. What I need to do is that when a user clicks a button, before the form...
10
by: ApexData | last post by:
I can't seem to make a PopUp Dialog form Invisible! 'My main form calls the PopUp DoCmd.OpenForm "F-PAUSE", WindowMode:=acDialog 'My PopUp form "F-PAUSE" contains this code Private Sub...
1
by: sudhendra pal | last post by:
Hello everybody, Can anybody help me..The scenario is when i click on jsp page link a popoup comes up. when i click on save button in popup then it should come to the same...
7
by: backups2007 | last post by:
I want to be able to create a popup window that opens everytime a user logs in. And that window displays all the status of the forms that the user has filled up. I have 3 types of form status....
2
by: panconlonga | last post by:
Hi every all. I Have a dude ( I hope you can help ). How can I generate Popups (Style MSN 6 => http://www.fotosmes.com/descargar/msn6/fotos/NickPopupVentanas.jpg ) in the a aplication visual...
5
by: Curious89 | last post by:
There are 3 buttons on a web page. On clicking each button a same popup window (say window1) opens up. Now there is another button on this popup window (window1), which further opens up to another...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.