• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4144
  • Last Modified:

From VBA, open a from as a "popup" or not.

Hi

I am using Office 365 -- Access

I am successfully using the command to open up a form.

        DoCmd.OpenForm "frm Item Categories", , , , , acWindowNormal

Open in new window

I would like to be able to have the option of opening this as a "popup" or not.

How do I do this?
0
peispud
Asked:
peispud
  • 4
  • 4
  • 3
  • +2
4 Solutions
 
Rey Obrero (Capricorn1)Commented:
i don't think there is an option to open a from as Pop-up in vba,
the options are

acdialog
achidden
acicon
acwindownormal
0
 
mbizupCommented:
Give this a try

Dim lngResponse 

lngResponse = iif (msgbox("Do you want to open the form as a popup") = vbYes, acDialog, acWindowNormal)

DoCmd.OpenForm "frm Item Categories", WindowMode := lngResponse

Open in new window

0
 
mbizupCommented:
cap's right about no specific "popup" option in VBA.  However "Dialog" is the Popup/Modal  combination.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
peispudAuthor Commented:
The "Modal" part of Popup/Modal seems to be a problem in my design hopes.

I would like this form to be one or several help screen that can be dragged onto a second monitor (the popup option allows this).

The "modal" part needs to be closed (so far as I know) before the calling application can continue.

I realize that I can create two identical forms (except for the "Popup" property) to do this, but that seems........
0
 
Rey Obrero (Capricorn1)Commented:
have you tried setting the PopUp property to yes in the design view of the form?
0
 
peispudAuthor Commented:
Yes I did and it works.

But I need this form to be available to be called up as "help window" on a second monitor.  Later, I need wish for this form to be called up as a full window  / modal (under Access).


In the first instance,  the user would be mostly referencing and looking up data that is already there (primary purpose).

In the second instance, the primary purpose would be to edit /add data.  Ergo, popup / modal.
0
 
Rey Obrero (Capricorn1)Commented:
you will then need two forms.
0
 
peispudAuthor Commented:
You might be right.   With respect,  I hope not.
0
 
Rey Obrero (Capricorn1)Commented:
why not, all you have to do is copy and paste the existing form and give it a new name,
then open it in design view and set the properties you require.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
This is for sure (from Help):

"The PopUp property can be set only in form design view."

Modal on the other hand can be set at run time.

mx
0
 
hnasrCommented:
This is a way to open form c as pop up.
You may open the form using VBA in design mode, set pop up property, then open normal, save changes.

DoCmd.OpenForm "c", acDesign
Forms!c.PopUp = True
DoCmd.OpenForm "c", acNormal
DoCmd.Save acForm, "c"

Open in new window

0
 
mbizupCommented:
The design view code does work - but there are a couple of cautions worth mentioning:

1.  I have seen a number of Experts linking run-time design changes to form corruption (I personally have not seen this happen, but don't have any databases where it is routinely done)

2.  IF you intend to distribute your database as an executable (mde/accde), that code will not work, because the Access Runtime version does not permit design changes.
0
 
peispudAuthor Commented:
All great and considered answers.   Thanks all,

So it can be done,  but I will go with two different forms in reference to the caution that Mbizup mentioned.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now