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

Back to previous, but now closed, form

stonward
100+
P: 145
Okay...no one fancied the last one, eh?! Can anyone help with this....I need a piece of code that allows a form to close then reopens the previous form. I'm sure there's a way, but tho' I love coding, I'm not yet that good at it...getting better every day however! Thanx,

Stonward
Aug 6 '07 #1
Share this Question
Share on Google+
6 Replies


Scott Price
Expert 100+
P: 1,384
Not sure what the 'last one/post' was, but your general DoCmd.OpenForm "FormName" in the on close event of your form should work...

Regards,
Scott
Aug 6 '07 #2

Rabbit
Expert Mod 10K+
P: 12,389
If you don't know what form is the previous form because there are multiple forms that could open it, then pass the form name in the OpenArgs parameter of DoCmd.OpenForm of the previous form.
Aug 6 '07 #3

stonward
100+
P: 145
Mmm. Sorry folks, not sure I'm getting it. I cant't NAME the form, because I don't know what form the user will have been using previously. So, when the user closes the current form, I need something to enable the form that was open prior to that one to open? Will OpenArgs do this? Can you show me the syntax? Thanks,

Stonward Roy.
Aug 7 '07 #4

Rabbit
Expert Mod 10K+
P: 12,389
OpenArgs won't do this, it only stores whatever value is passed in it.

So let's say you have multiple forms, Form1, Form2, Form3. And they can all open Form4.

Well, when you go to open the Form4 from any one of them, you can use:
DoCmd.OpenForm "Form4", , , , , , "Formx"
where x is the originating form.

Now you have access to that variable using Me.OpenArgs which stores the value of the form. So you can open up the old form using:
DoCmd.OpenForm Me.OpenArgs
Aug 7 '07 #5

stonward
100+
P: 145
Cool!
Thanks, Rabbit.

Stonward
Aug 8 '07 #6

Rabbit
Expert Mod 10K+
P: 12,389
Not a problem, good luck.
Aug 8 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.