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

Go Back to the previous FORM

P: n/a
How can I create a button that would take me back to the previous form
not the previous record, but the previous form that I just moved from
using VBA? Any sample code would be greatly appreciated.

Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Cheryl,
I think we need a little more information. Let me guess and we'll see
if it helps. I assume you have form A that is open and something on
it opens B. Now you want to close B so that you are looking at A.
Create a button on B - lets call it cmdBack
private sub cmdback_click()
forms!A.setfocus'brings the form to the front
docmd.close acform,me.name'will close the current form
end sub

Another way to manage multiple forms that is much easier for you to
manage and much easier for the user to navigate, is using tabs. You
can put a separate form on each tab. No more confusing poppng up
forms.
HTH
Pachydermitis

Nov 13 '05 #2

P: n/a
Cheryl,
I think we need a little more information. Let me guess and we'll see
if it helps. I assume you have form A that is open and something on
it opens B. Now you want to close B so that you are looking at A.
Create a button on B - lets call it cmdBack
private sub cmdback_click()
forms!A.setfocus'brings the form to the front
docmd.close acform,me.name'will close the current form
end sub

Another way to manage multiple forms that is much easier for you to
manage and much easier for the user to navigate, is using tabs. You
can put a separate form on each tab. No more confusing poppng up
forms.
HTH
Pachydermitis

Nov 13 '05 #3

P: n/a
rkc
Cheryl wrote:
How can I create a button that would take me back to the previous form
not the previous record, but the previous form that I just moved from
using VBA? Any sample code would be greatly appreciated.


In it's simplest form, pass the calling form's name to the called
form in the OpenArgs parameter of the Docmd.Open function.

Using the wizard lingo that would be
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.Name

To get back to the calling form
If you closed it: DoCmd.OpenForm Me.OpenArgs
If not: Forms.item(Me.OpenArgs).SetFocus


Nov 13 '05 #4

P: n/a
rkc
Cheryl wrote:
How can I create a button that would take me back to the previous form
not the previous record, but the previous form that I just moved from
using VBA? Any sample code would be greatly appreciated.


In it's simplest form, pass the calling form's name to the called
form in the OpenArgs parameter of the Docmd.Open function.

Using the wizard lingo that would be
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.Name

To get back to the calling form
If you closed it: DoCmd.OpenForm Me.OpenArgs
If not: Forms.item(Me.OpenArgs).SetFocus


Nov 13 '05 #5

P: n/a
Thank you for the information, let me give more detail. I have 6
different forms: frmStudent, frmRegistration, frmRecruitment, frmGrade,
frmPayment, frmPlacement. I have 6 icons on the right-side that you
can click on to go to each from. They could could click on the side
bar and go to any form they wish, but this is what the user is asking
for: if they are working on frmStudent and then they go to
frmPlacement instead of clicking on the icon they want to click on a
backarrow on frmPlacement and go back to frmStudent.

Nov 13 '05 #6

P: n/a
Thank you for the information, let me give more detail. I have 6
different forms: frmStudent, frmRegistration, frmRecruitment, frmGrade,
frmPayment, frmPlacement. I have 6 icons on the right-side that you
can click on to go to each from. They could could click on the side
bar and go to any form they wish, but this is what the user is asking
for: if they are working on frmStudent and then they go to
frmPlacement instead of clicking on the icon they want to click on a
backarrow on frmPlacement and go back to frmStudent.

Nov 13 '05 #7

P: n/a
rkc
Cheryl wrote:
Thank you for the information, let me give more detail. I have 6
different forms: frmStudent, frmRegistration, frmRecruitment, frmGrade,
frmPayment, frmPlacement. I have 6 icons on the right-side that you
can click on to go to each from. They could could click on the side
bar and go to any form they wish, but this is what the user is asking
for: if they are working on frmStudent and then they go to
frmPlacement instead of clicking on the icon they want to click on a
backarrow on frmPlacement and go back to frmStudent.

So all forms are opened from 6 icons that essentially make up a
switchboard form? In that case you could keep track of which
form was opened last using a local variable in the switchboard
form. Each time a form is opened pass the value of that variable
to the form being opened and then update the variable to the name
of the form being opened. If you check for a value in OpenArgs
each time a form is opened, you will be able to tell whether
your "back arrow" should be enabled. No value means there is
no form to go back to.


Nov 13 '05 #8

P: n/a
rkc
Cheryl wrote:
Thank you for the information, let me give more detail. I have 6
different forms: frmStudent, frmRegistration, frmRecruitment, frmGrade,
frmPayment, frmPlacement. I have 6 icons on the right-side that you
can click on to go to each from. They could could click on the side
bar and go to any form they wish, but this is what the user is asking
for: if they are working on frmStudent and then they go to
frmPlacement instead of clicking on the icon they want to click on a
backarrow on frmPlacement and go back to frmStudent.

So all forms are opened from 6 icons that essentially make up a
switchboard form? In that case you could keep track of which
form was opened last using a local variable in the switchboard
form. Each time a form is opened pass the value of that variable
to the form being opened and then update the variable to the name
of the form being opened. If you check for a value in OpenArgs
each time a form is opened, you will be able to tell whether
your "back arrow" should be enabled. No value means there is
no form to go back to.


Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.