Form not functioning properly

D

Dale Fye

I've got a form that I use the following code to open.

Private sub lbl_Admin_Click
me.visible = false
DoCmd.OpenForm "frm_Admin"
'Don't go back to the main form while "frm_Admin" is loaded
While CurrentProject.AllForms("frm_Admin").IsLoaded: DoEvents: Wend
me.visible = true
end sub

I use this code, rather than opening the form in Dialog mode, because
"frm_Admin" has a couple of buttons on it that hide it, and open other forms.
If I didn't have the While:Wend loop in here, when I hide frm_Admin, my
splash screen would be made visible again.

This works OK, except that for some reason, when I open frm_Admin, it will
not allow me to perform any actions on the form until I have left the Access
window and set my focus on some other Windows application. If I [Alt-tab] to
another app, then back to frm_Admin, all of the controls (bound and othewise)
work properly.

I don't recall ever having had this problem in the past, and have used this
technique on multiple occassions. Would appreciate comments, or alternative
solutions.

Dale
 
D

Dale Fye

John,

The issue is not which form is visible, that piece works, the problem is
that frm_Admin doesn't seem to get activated until after I go to some other
application. I've never experienced this before

Actually, the way you opened your secondary form (using acDialog), Access
won't execute the following line until SecondaryForm closes. So I am certain
that frm_Splash will become visible and remain visible as soon as I hide
frm_Admin.

Dale
--

email address is invalid
Please reply to newsgroup only.



J_Goddard via AccessMonster.com said:
Hi -

When frm_Admin opens the secondary forms, did you try opening those forms in
dialog mode, then restoring frm_Admin when the secondary forms close? That
should prevent the splash screen from reappearing.

for example, in the frm_Admin button code:

forms!frm_admin.visible = false
docmd.openform secondaryform, , , , , acdialog
forms!frm_admin.visible = True

John



Dale said:
I've got a form that I use the following code to open.

Private sub lbl_Admin_Click
me.visible = false
DoCmd.OpenForm "frm_Admin"
'Don't go back to the main form while "frm_Admin" is loaded
While CurrentProject.AllForms("frm_Admin").IsLoaded: DoEvents: Wend
me.visible = true
end sub

I use this code, rather than opening the form in Dialog mode, because
"frm_Admin" has a couple of buttons on it that hide it, and open other forms.
If I didn't have the While:Wend loop in here, when I hide frm_Admin, my
splash screen would be made visible again.

This works OK, except that for some reason, when I open frm_Admin, it will
not allow me to perform any actions on the form until I have left the Access
window and set my focus on some other Windows application. If I [Alt-tab] to
another app, then back to frm_Admin, all of the controls (bound and othewise)
work properly.

I don't recall ever having had this problem in the past, and have used this
technique on multiple occassions. Would appreciate comments, or alternative
solutions.

Dale

--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
 
D

Dale Fye

John,

I have to disagree with you. I agree that it works fine for the first level
but if you have a third form, as soon as you hide level 2, level 1 becomes
visible again.

frmSplash
|
|-- frmAdmin
|
|-- frmAdminReports

1. Assume you hide frmSplash and then open frmAdmin using acDialog.
Private sub lbl_Admin_Click
me.visible = false
'since this is air code, I'm sure that I have the wrong number of
'commas in the next line
docmd.openform "frmAdmin",,,,,acDialog
me.visible = true
end sub
2. Then you hide frmAdmin and open frmAdminReports using acDialog.
3. Any code that follows docmd.openform frmAdmin,,,,,acdialog in frmSplash
will execute as soon as frmAdmin is either closed or hidden. You can resolve
this by putting the code to make frmSplash visible in the close event of
frmAdmin

But this doesn't address my problem, which is not about the form opening or
closing or being hidden, but about frmAdmin not being functional (I cannot
click in any bound field or on any control until I set the focus to some
other Windows application and then come back frmAdmin).

Dale

--

email address is invalid
Please reply to newsgroup only.



J_Goddard via AccessMonster.com said:
HI -
Actually, the way you opened your secondary form (using acDialog), Access
won't execute the following line until SecondaryForm closes.

That's the whole idea. By opening frm_Admin and all the secondary forms with
acDialog, you stop further code from executing until each form closes.

I just realized I left out an important point - you need to open frm_Admin
using acdialog as well, to pause the code that opens it, otherwise yes, your
splash screen will be visible before you want it. When frm_Admin is made
visible again with forms!frm_admin.visible = True, it is still open in dialog
mode, so the code that called it is still paused.

I use this technique of hiding and restoring forms opened with acDialog in my
applications, and it works fine.

John


By doing this, you would not need the DoEvents loop.

John



Dale said:
John,

The issue is not which form is visible, that piece works, the problem is
that frm_Admin doesn't seem to get activated until after I go to some other
application. I've never experienced this before

Actually, the way you opened your secondary form (using acDialog), Access
won't execute the following line until SecondaryForm closes. So I am certain
that frm_Splash will become visible and remain visible as soon as I hide
frm_Admin.

Dale
[quoted text clipped - 36 lines]

--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
 

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