syntax for setting a form to "PopUp"

C

Chris Freeman

I want certain users to see a form as a Popup, and others not to. I followed
the Help and tried:
If Level = "3" Then
With Forms("frmMain")
.PopUp = True
End With
End If

I also tried me.popup=true

but I keep getting a "You can't assign a value to this object" error
message. What's the correct syntax for this/

thanks
 
S

Stuart McCall

Chris Freeman said:
I want certain users to see a form as a Popup, and others not to. I
followed
the Help and tried:
If Level = "3" Then
With Forms("frmMain")
.PopUp = True
End With
End If

I also tried me.popup=true

but I keep getting a "You can't assign a value to this object" error
message. What's the correct syntax for this/

thanks

There is no correct syntax, because the Popup property can only be set in
form design view.

Maybe have two forms, one popup and one not?
 
C

Chris Freeman

Stuart,
The syntax was copied from the Access help guide, and fully implied that
this could be done programmatically. also, its part of the access object
library, so that also implies the settings can be manipluated
programmatically, just like setting .visible or .maximize.

I'll keep searching
 
A

Albert D. Kallal

Chris Freeman said:
Stuart,
The syntax was copied from the Access help guide, and fully implied that
this could be done programmatically. also, its part of the access object
library, so that also implies the settings can be manipluated
programmatically, just like setting .visible or .maximize.

Yes, it can be done by using code, but the form has to be placed in design
mode in code BEFORE you attempt to change the property. You would then have
to save the form, and then relaunch the form and regular view mode.

I cannot put into words how strongly I would avoid having applications that
try to modify things in design mode at runtime in a production application.

There litlte problem with modifying the position of controls on a form, as
long as you're not flipping the form into design mode (and in fact you can
actually change positions of controls on a form quite easily in code, and no
design mode are required at all).

So it's not an issue of changing certain forms properties, if they can be
freely changed without flipping the form into design mode, then by all means
it's certainly an OK programming practice, but having to place a form into
design mode in production systems, then I would seek other types of
solutions.
 
C

Chris Freeman

Ahhh...that's so cheesy of them (MS). all the examples listed seem to
indicate that this can be set through VBA:

'from the help page
Example
The following example sets the "Switchboard" form to be a modal pop-up form
that has just a Close button.

With Forms("Switchboard")
.PopUp = True
.Modal = True
.BorderStyle = 3 ' Dialog style.
End With

But alas it ain't so. OK, so next round would be: I can remove the form view
and formatting tools bars, but what about the menu bar. Trying to minimize
the user having access to the back end. I guess I could also turn those off
using setup, but wanted high level users to have the access to the toolbars.
maybe I'll have turned back on if the security level matches criteria.

Thanks
 
C

Chris Freeman

OK, to all, thanks for all your help here. I thought I could turn off
toolbars under StartUp, not Setup as I said before, and then turn them on
based on users security level. i ws using this code, which turned them off
before:

If Level = "3" Then
DoCmd.ShowToolbar "Form View", acToolbarYes
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarYes
End If

And they are not turning on. do I have a syntax error here? I think I'll
just do a simpler version of opening a small window, and then using a
do.cmdOpenFrom from that window, and set the property to Dialog
 
A

Albert D. Kallal

Chris Freeman said:
Ahhh...that's so cheesy of them (MS). all the examples listed seem to
indicate that this can be set through VBA:


You can set this through VBA, the problem is you would also have to use some
VBA to open the form into design mode first, then change the setting, then
save the form, then relaunch the form. Note that all of this is possible
through VBA, but as mentioned strongly recommended as being a very very bad
idea.

About the best idea I can come up with is to build the one form. In the
casse in which you need this for to be popup, simply place the form inside
of a another form as a sub form (but just size them quite similar that you
can hardly tell this is the case). this is a far better idea than trying to
maintain exactly two copies of the farm, one of which has the popup
setting=true.

With the above idea, you'll be able to open the form in either mode, but
still only have to maintain one form in terms of programming and desing
changes to the form over the life of the application.
 
A

Albert D. Kallal

\
And they are not turning on. do I have a syntax error here? I think I'll
just do a simpler version of opening a small window, and then using a
do.cmdOpenFrom from that window, and set the property to Dialog
--

see my other answer with a solution. keep in mind is no setting in a form to
open a form as dialog, it's when you open it using the open command is where
the setting takes place. note that a dialog form can only have the focus,
and not even built and menu bars for ribbons can receive the focus when a
dialog form is opened.

So, we have:

Diaglog fomrs
model forms
popup forms
regular forms

All in the above forms are very distinctly different and have different
uses. If your goal is to have an information form displayed, *while* the
focus can be had in other forms during operation of the application, then
the correct choice is to use a popup form, this is exactly what they are
designed for.

So you can use my suggestion in the other thread in which you simply drop
the form into another form as a sub form, and then set the popup of that
"main" form. You will not have to maintain two forms this way, nor will you
have to write any code to set or manage this particular setting, you just
open either one of the forms, which will both display the same form, but one
is actually displayed as a sub form inside of a parent form...
 
M

Marshall Barton

Chris said:
OK, to all, thanks for all your help here. I thought I could turn off
toolbars under StartUp, not Setup as I said before, and then turn them on
based on users security level. i ws using this code, which turned them off
before:

If Level = "3" Then
DoCmd.ShowToolbar "Form View", acToolbarYes
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarYes
End If

And they are not turning on. do I have a syntax error here? I think I'll
just do a simpler version of opening a small window, and then using a
do.cmdOpenFrom from that window, and set the property to Dialog


You can hide a tool/menu bar with
DoCmd.ShowToolbar "Menu Bar", acToolbarNo

And show them with
DoCmd.ShowToolbar "Menu Bar", acToolbarYes

Or, you can use the Enabled or Visible properties of a
CommandBar object in the CommandBars collection
CommandBars("Menu Bar").Enabled = False
CommandBars("Menu Bar").Visible = False

I don't know which (if any) of those the Startup option
uses.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top