Detect acDialog setting in OnOpen event?

K

Keithr

Anyone know how I can detect if a form has been opened with acDialog set? I
have a situation where the form needs to behave differently if opened in
acDialog than in acWindowNormal. Basically, I need to create forms that can
be optionally used as custom dialog boxes, but not always used in this manner.
 
K

Keithr

I know about using the OpenArgs option to pass additional information. I'm
trying to make the for as self-contained as possible.
 
R

Rick Brandt

Keithr said:
Anyone know how I can detect if a form has been opened with acDialog
set? I have a situation where the form needs to behave differently
if opened in acDialog than in acWindowNormal. Basically, I need to
create forms that can be optionally used as custom dialog boxes, but
not always used in this manner.

I thought maybe you could test the Popup and Modal properties, but in my
testing these do not change when acDialog is used. I suppose that whenever
you use acDialog you could also include an OpenArgs value and then test for
that in your form.
 
A

Albert D.Kallal

You can always pass a value via open args, and test for this.

Further, are you sure you need acDialog forms, or can you use model forms?

If you use model forms, then you can do

docmd.openform "yourform"

yourform.MyModelValue = true

The value MyModelValue can be a custom property "LET", or even a module
level var declared as public.

note that for model forms, code keeps running after the open, but not for
acDialog forms.

So, perhaps passing values openargs could work.

Last, but not least, I do explain here how to made dialog forms, and have
them RETURN values to calling code:

http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html
 
D

Dirk Goldgar

Keithr said:
Anyone know how I can detect if a form has been opened with acDialog
set? I have a situation where the form needs to behave differently
if opened in acDialog than in acWindowNormal. Basically, I need to
create forms that can be optionally used as custom dialog boxes, but
not always used in this manner.

This discussion thread (from Google Groups) includes a possible solution
to this problem -- given that you don't want to pass something in
OpenArgs.


http://groups-beta.google.com/group...read/thread/931cf07b80f32c06/c023db6c6fbb60a1
 
K

Keithr

Thanks Dirk. That's the one I've been looking for, for the same reason as
Nhan - it enables me to build a set of components that can be incorporated
into earlier solutions during upgrades without risks of missing re-coding a
step to pass extra parameters. The original discussion thread is
interesting, particularly some of the comments about whether or not it is
necessary. Designing context sensitivity into components and making them
more adaptable and re-usable isn't just the preserve of the VB and C++ hacks!
It's something we can all do, even in MS Office development.

Keith
 

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