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


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?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Rey Obrero (Capricorn1)Connect With a Mentor Commented:
you will then need two forms.
Rey Obrero (Capricorn1)Commented:
i don't think there is an option to open a from as Pop-up in vba,
the options are

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

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

cap's right about no specific "popup" option in VBA.  However "Dialog" is the Popup/Modal  combination.
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........
Rey Obrero (Capricorn1)Commented:
have you tried setting the PopUp property to yes in the design view of the form?
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.
peispudAuthor Commented:
You might be right.   With respect,  I hope not.
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.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
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.

hnasrConnect With a Mentor Commented:
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

mbizupConnect With a Mentor Commented:
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.
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.