views:

204

answers:

1

So I am trying to use a button click to open the next form (in my form flow), and pass the ID to the next form using openArgs:

docmd.openform "NextForm",,,,,, MainID
docmd.close acform, "CurrentForm", acSaveYes

the second form will not open....i have never run into this problem with a docmd.openform in a sub before. however, this is my first experience using OpenArgs....usually I would pass a value to a hidden text box, but I am trying something different.

The routine runs without error, and the currentform closes just as it should. It's like access is convinced the second form is in fact open, but its not showing up. Also if I even try to show the database objects window, and just click open the form from there.....nothing

please help! thanks Justin

+2  A: 

It's like access is convinced the second form is in fact open, but its not showing up.

If you get no error message when the form apparently fails to open, check whether NextForm is present in the Forms collection. In the Immediate Window, try:

? Forms("NextForm").Name

What happens? The Forms collection includes the forms which are open. If you get an error message that NextForm isn't found, then NextForm is not open. But, if that command returns the name NextForm, the form is open but you can't see it.

That can happen in at least 2 ways:

  1. form has been opened hidden
  2. form has been opened at a screen position outside your visible display area

If the form really does not open, and you're not getting an error message, make sure you don't have SetWarnings and Echo turned off.

If those suggestions don't lead you to the cure, show us what NextForm is attempting to do with OpenArgs. Can you get NextForm to open if you temporarily disable its OpenArgs handling code?

Update: A couple more questions ...

Can you open NextForm in design view?

What happens if you try the following command in the Immediate Window? Error message?

DoCmd.OpenForm "NextForm",,,,,acWindowNormal
HansUp
you were right Hans....they were displaying as hidden because they had no control boxes. ONce I enabled the control box...all you could see was the control box until I sized it back up...thanks!
Justin
That's good news! I haven't yet encountered a situation where a form failed to open **without** an error message. I don't know if it's even possible. So your lack of an error message made me suspect the form really did open. Meanwhile, I'm still curious about when a form could ever fail to open without an error message.
HansUp