Opening a form when another form is opened 
Author Message
 Opening a form when another form is opened

Hello. I have a data entry form (FormA) for which I want to display a
"warning" form with some brief user instructions (FormB) any time FormA is
selected from a menu.

Going by the books, I have set up the following event procedure in FormA:

DoCmd.OpenForm "FormB"

The problem is, when I open FormA from the menu, it does open FormB, but
it's behind FormA and can't be seen. I tried adding:

Forms!FormB.SetFocus

to the event procedure, and also tried the event procedure on what would
seem all the applicable events...onopen, onload, onactivate, etc. but
nothing changes.

Help! What am I missing? Thanks...



Sun, 23 Sep 2001 03:00:00 GMT  
 Opening a form when another form is opened
This is in the on open event of formA.

I would consider a msgbox "Blah, blah, blah.",vbokonly,"Please Read"
instead, but you can change the modal/popup properties of FormB to yes and
that should do it.

Quote:

>Hello. I have a data entry form (FormA) for which I want to display a
>"warning" form with some brief user instructions (FormB) any time FormA is
>selected from a menu.

>Going by the books, I have set up the following event procedure in FormA:

>DoCmd.OpenForm "FormB"

>The problem is, when I open FormA from the menu, it does open FormB, but
>it's behind FormA and can't be seen. I tried adding:

>Forms!FormB.SetFocus

>to the event procedure, and also tried the event procedure on what would
>seem all the applicable events...onopen, onload, onactivate, etc. but
>nothing changes.

>Help! What am I missing? Thanks...



Sun, 23 Sep 2001 03:00:00 GMT  
 Opening a form when another form is opened
I would also agree with a msgbox.

If you are going to use a form for this then I would think you should have
the button control that currently opens FormA  to open FormB.  Have an OK
button or something on FormB that closes it and opens FormA.

I have had cases where even the modal forms pop up "behind" currently open
windows.  I think right now you have the DoCmd.OpenForm "FormB" in the
OnLoad event of FormA.  FormA is not displayed at the OnLoad event. Thus it
is displayed after the FormB is displayed placing it on top.
One way around this is to move it from the OnLoad to the OnCurrent event.
You will need a test variable because the OnCurrent event occurs when the
form is updated and you only want to open the warning form the first time I
think.
here is a small ex.   (I know this is not a preferred way of programming but
it works.  And I know the syntax may be off)
FormA
sub onload
dim testvar as string
testvar = "Y"
end sub

sub Oncurrent
if testvar = "Y" then
   DoCmd.OpenForm "FormB"
   testvar = "N"
end sub

Quote:

>This is in the on open event of formA.

>I would consider a msgbox "Blah, blah, blah.",vbokonly,"Please Read"
>instead, but you can change the modal/popup properties of FormB to yes and
>that should do it.


>>Hello. I have a data entry form (FormA) for which I want to display a
>>"warning" form with some brief user instructions (FormB) any time FormA is
>>selected from a menu.

>>Going by the books, I have set up the following event procedure in FormA:

>>DoCmd.OpenForm "FormB"

>>The problem is, when I open FormA from the menu, it does open FormB, but
>>it's behind FormA and can't be seen. I tried adding:

>>Forms!FormB.SetFocus

>>to the event procedure, and also tried the event procedure on what would
>>seem all the applicable events...onopen, onload, onactivate, etc. but
>>nothing changes.

>>Help! What am I missing? Thanks...



Sun, 23 Sep 2001 03:00:00 GMT  
 Opening a form when another form is opened
David and Richard...

**Thank you to both of you.** I got it working now. Some of the warnings are
using msgbox, but in some places we can't because of the amount of text and
how the users want the warning box formatted. Your suggestions are a great
help.



Mon, 24 Sep 2001 03:00:00 GMT  
 Opening a form when another form is opened
You might have to split this up.  Open FormB through the onOpen event, then use
this in the on current:

Private Sub Form_Current()
On Error Resume Next
Forms!formB.Restore             'or
forms!formb.setfocus             'If FormB is around, then setfocus to it.
End Sub

Try this on for size...... Hope that helps.

Quote:

> David and Richard...

> **Thank you to both of you.** I got it working now. Some of the warnings are
> using msgbox, but in some places we can't because of the amount of text and
> how the users want the warning box formatted. Your suggestions are a great
> help.

--
-----------------------------------
Matthew Miller
Ready Net Go, Inc.



Tue, 25 Sep 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Open form, close form, open form = disposed object exception

2. Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable

3. If opened with shift, open form?

4. opening form on opening template

5. How can i block opening a form that is already open

6. open form from other form

7. Time Delay, close current form, open new form

8. can a form on item_open find out what view the form was opened

9. Form name is Text, how do I open form

10. i can't open a inherited form with form editor (beta 2)

11. Can't open form in Form View...

12. opening a form in a form

 

 
Powered by phpBB® Forum Software