Form visible question

J

Junior

On click event - on Form1 i call a sub and open [frm2] to set some user
defined variables
when frm2 closes the action returns to the sub...
but Form1 doesn't become visible again -
what am i doing wrong?

on click on Form1
blah, blah.....
DoCmd.OpenForm "frm2", DataMode:=acFormEdit, WindowMode:=acDialog
DoCmd.SetWarnings False
DoCmd.Hourglass True
Me.Visible = True
blah blah.....
 
S

Sam Guffey

Junior,

Try adding the following code to the OnClose event of frm2:

Forms.Form1.Visible = True
Forms.Form1.<somecontrol>.SetFocus

Hope this helps.
Sam
 
J

Junior

Sam - that didn't work - the problem is Form1 only partially reappears and
frm2 doesn't disappear form the screen until all the code runs...

Sam Guffey said:
Junior,

Try adding the following code to the OnClose event of frm2:

Forms.Form1.Visible = True
Forms.Form1.<somecontrol>.SetFocus

Hope this helps.
Sam
-----Original Message-----
On click event - on Form1 i call a sub and open [frm2] to set some user
defined variables
when frm2 closes the action returns to the sub...
but Form1 doesn't become visible again -
what am i doing wrong?

on click on Form1
blah, blah.....
DoCmd.OpenForm "frm2", DataMode:=acFormEdit, WindowMode:=acDialog
DoCmd.SetWarnings False
DoCmd.Hourglass True
Me.Visible = True
blah blah.....


.
 
S

ScottE

The best way I know of to use a second form to get data
from the user is to call the second form in acDialog
windowmode, as you did. On the second form, do not
display the close button or the control box. Allow the
form to be "closed" only with a button you create. Label
it "close" or whatever you want. Set the onclick event of
that button to do two things only: make the current form
not visible and make the original form visible. Code will
then resume with the original form (both closing and
hiding a form "stop" the dialog mode), and you can easily
retrieve any values from the second form, since it's still
open.

Hope this helps!

- Scott
-----Original Message-----
Sam - that didn't work - the problem is Form1 only partially reappears and
frm2 doesn't disappear form the screen until all the code runs...

Junior,

Try adding the following code to the OnClose event of frm2:

Forms.Form1.Visible = True
Forms.Form1.<somecontrol>.SetFocus

Hope this helps.
Sam
-----Original Message-----
On click event - on Form1 i call a sub and open [frm2]
to
set some user
defined variables
when frm2 closes the action returns to the sub...
but Form1 doesn't become visible again -
what am i doing wrong?

on click on Form1
blah, blah.....
DoCmd.OpenForm "frm2", DataMode:=acFormEdit, WindowMode:=acDialog
DoCmd.SetWarnings False
DoCmd.Hourglass True
Me.Visible = True
blah blah.....


.


.
 
G

Guest

Junior,

Sorry that didn't work for you. It would help me to see
the code we're talking about. If you could send me a copy
I'd be happy to look at it. I'm thinking that perhaps
putting the 'Forms.Form1.Visible = True' at the end of
your sub might yeild better results than the On Close
event. Another possibility would be to put a me.requery or
me.refresh statement on the On Got Focus event of whatever
control you attempted to set focus to. That should force a
repainting of the screen.

Sam
-----Original Message-----
Sam - that didn't work - the problem is Form1 only partially reappears and
frm2 doesn't disappear form the screen until all the code runs...

Junior,

Try adding the following code to the OnClose event of frm2:

Forms.Form1.Visible = True
Forms.Form1.<somecontrol>.SetFocus

Hope this helps.
Sam
-----Original Message-----
On click event - on Form1 i call a sub and open [frm2]
to
set some user
defined variables
when frm2 closes the action returns to the sub...
but Form1 doesn't become visible again -
what am i doing wrong?

on click on Form1
blah, blah.....
DoCmd.OpenForm "frm2", DataMode:=acFormEdit, WindowMode:=acDialog
DoCmd.SetWarnings False
DoCmd.Hourglass True
Me.Visible = True
blah blah.....


.


.
 

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

Similar Threads


Top