By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,077 Members | 2,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,077 IT Pros & Developers. It's quick & easy.

Seeking alternative for suspending code execution with acDialog parm in A97...

P: n/a
MLH
Having identified a A97 bug in which acDialog causes undesirable side
effects processing the opened form, I would like to replace the
following code running in MyForm ...

DoCmd.OpenForm "frmVehicleChooserForm", , , , , acDialog
.... (more code I want to run after suspension)

With this new approach...
DoCmd.OpenForm "frmVehicleChooserForm", , , , , , ThisForm
Me.Visible = False
Me.TimerInterval = 100
(10 times per second, I want the OnTimer property code to see if
frmVehicleChooserForm has closed. When it has, I want MyForm
to be made visible and for the above

(more code I want to run after suspension)

to be ran. Is this approach sound?
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
MLH wrote:
Having identified a A97 bug in which acDialog causes undesirable side
effects processing the opened form, I would like to replace the
following code running in MyForm ...

DoCmd.OpenForm "frmVehicleChooserForm", , , , , acDialog
... (more code I want to run after suspension)

With this new approach...
DoCmd.OpenForm "frmVehicleChooserForm", , , , , , ThisForm
Me.Visible = False
Me.TimerInterval = 100
(10 times per second, I want the OnTimer property code to see if
frmVehicleChooserForm has closed. When it has, I want MyForm
to be made visible and for the above

(more code I want to run after suspension)

to be ran. Is this approach sound?


Why don't you have frmVehicleChooserForm set the calling form's visible
property to false? And in the OnClose event of the chooser set it visible?

Sometimes I do something like this
Docmd.Openform "SomeFormName",,,,,acDialog
If IsOpen("SomeFormName") Then
...process code
endif

What happens here is that I open a form as a popup. In the popup I may
have a Select and Exit button. If Exit is pressed, I close the form.
If Select is pressed, I make it invisible. This passes control back to
the calling form. In your case you might want to make the calling form
visibible first then make the current form hidden.
Nov 13 '05 #2

P: n/a
MLH <CR**@NorthState.net> wrote in
news:gm********************************@4ax.com:
Having identified a A97 bug in which acDialog causes undesirable
side effects processing the opened form, I would like to replace
the following code running in MyForm ...

DoCmd.OpenForm "frmVehicleChooserForm", , , , , acDialog
... (more code I want to run after suspension)

With this new approach...
DoCmd.OpenForm "frmVehicleChooserForm", , , , , , ThisForm
Me.Visible = False
Me.TimerInterval = 100
(10 times per second, I want the OnTimer property code to see if
frmVehicleChooserForm has closed. When it has, I want MyForm
to be made visible and for the above

(more code I want to run after suspension)

to be ran. Is this approach sound?


Where is the problem with your original code?

I don't see any.

You've said that you need to initialize a bunch of global variables
when the form becomes visible.

Well, why?

Is it so you can use the global variables to get information out of
frmVehicleChooserForm into MyForm? If so, well, there's your problem
-- don't use global variables, just refer directly to the controls
on frmVehicleChooserForm that have the data that you're storing in
the global variables.

Alternatively, don't use DoCmd.Openform to open/reveal the dialog,
but instead use a custom subroutine that sets the global variables
and then issues the DoCmd.Openform.

But a much simpler way to fix all of these is to CLOSE THE DIALOG
AFTER YOU'RE DONE WITH IT.

When I use a dialog form it looks like this:

DoCmd.OpenForm "dlgWhatever", , , , , acDialog
[execution pauses until dlgWhatever is hidden
with its CLOSE button]
If Forms!dlgWhatever.Tag <> "Cancel" Then
[the close button on the dialog hides it,
and the Cancel button sets the form's .Tag
to "Cancel" and then hides it]
[do whatever you want with the data from the dialog]
End If
DoCmd.Close acForm, "dlgWhatever"
The next time you call the code, the form will be closed, so its
OnOpen or OnLoad events will be the place to re-initialize the
global variables.

And I see no reason for a dialog form to need to know anything about
the form that called it (you're passing an opening argument with the
calling form's name, if I'm reading your code correctly). The
calling form should be the one that needs to know about the dialog,
and not the other way around.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3

P: n/a
MLH
Good suggestion. I'm going to give your method a try. BTW, I call the
dialog form from several other forms. I've been using openform to go
back to the parent form instead of parentform.visible=true. That's why
I passed the parent form name to dialogform - just so openform
me.openargs would work.
Nov 13 '05 #4

P: n/a
MLH
Thanks, Salad. I'm gonna play with this some.
It seems sound at first glance.
Nov 13 '05 #5

P: n/a
MLH <CR**@NorthState.net> wrote in
news:nu********************************@4ax.com:
Good suggestion. I'm going to give your method a try. BTW, I call
the dialog form from several other forms. I've been using openform
to go back to the parent form instead of parentform.visible=true.
That's why I passed the parent form name to dialogform - just so
openform me.openargs would work.


Why are you making the parent form invisible?

And if you are, why do it in the dialog form's code?

This accomplishes the same thing (hiding the parent form) without
the dialog needing to know what the parent form is:

[code in parent form]
Me.Visible = False
DoCmd.OpenForm "dlgMyDialog", , , , , , acDialog
[do what you need with the data collected in the dialog form]
Me.Visible = True

Personally, I would find it disconcerting to have the form from
which I launch a dialog disappear while the dialog is open. And if
that's the only reason you're passing the calling form's name, I'd
seriously reconsider what value there is to doing it that way.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.