Stacked Forms

B

Bonnie A

Hi everyone! Using A02 on XP. I have a HUGE form that works best in 14
sections. On my main form I have a button to open the first form. To run
them in sequence, each form has a Next button to open the forms in a certain
order. However, when I'm done I have a stack of 15 forms open (Main form
plus the 14 sections). What is the best way to close them? All at once from
the 14th segment or as I move from form to form? I put a DoCmd.Close in the
code that opens the next form but get an error message "The expression you
entered referrs to an object that is closed or doesn't exist." Here is my
code. (I get the error after I insert the DoCmd.Close, the rest of it works
fine before the insertion.)

Private Sub Next_Click()
On Error GoTo Err_Next_Click
DoCmd.Close 'I INSERTED THIS LINE
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fPlanAuditSub02SPY"

stLinkCriteria = "[AuditID]=" & Me![AuditID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Next_Click:
Exit Sub

Err_Next_Click:
MsgBox Err.Description
Resume Exit_Next_Click

End Sub

On the form above, I want to be able to open fPlanAuditSub02SPY and close
fPlanAuditSub01Census.

Looking for advice on how best to do this. Thanks in advance for any help.
 
K

kingston via AccessMonster.com

Use the next form's On Open event to close the previous one:
DoCmd.Close acForm,"Last Form"

Also, consider placing all of these forms together via tabs onto a single
form. Loading and unloading the form may take a while but the user will have
some continuity moving between different parts of the data.

Bonnie said:
Hi everyone! Using A02 on XP. I have a HUGE form that works best in 14
sections. On my main form I have a button to open the first form. To run
them in sequence, each form has a Next button to open the forms in a certain
order. However, when I'm done I have a stack of 15 forms open (Main form
plus the 14 sections). What is the best way to close them? All at once from
the 14th segment or as I move from form to form? I put a DoCmd.Close in the
code that opens the next form but get an error message "The expression you
entered referrs to an object that is closed or doesn't exist." Here is my
code. (I get the error after I insert the DoCmd.Close, the rest of it works
fine before the insertion.)

Private Sub Next_Click()
On Error GoTo Err_Next_Click
DoCmd.Close 'I INSERTED THIS LINE
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fPlanAuditSub02SPY"

stLinkCriteria = "[AuditID]=" & Me![AuditID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Next_Click:
Exit Sub

Err_Next_Click:
MsgBox Err.Description
Resume Exit_Next_Click

End Sub

On the form above, I want to be able to open fPlanAuditSub02SPY and close
fPlanAuditSub01Census.

Looking for advice on how best to do this. Thanks in advance for any help.
 
B

Bonnie A

Hi Kingston! Wanted to thank you VERY much for the info and super fast
response. I knew it was a simple thing but had the logic wrong. I did
consider tabs for a sec but have heard bad things about them. Thanks again
for your help!!! Thanks for being a teacher in these newsgroups.

P.S. It works GREAT!
--
Bonnie W. Anderson
Cincinnati, OH


kingston via AccessMonster.com said:
Use the next form's On Open event to close the previous one:
DoCmd.Close acForm,"Last Form"

Also, consider placing all of these forms together via tabs onto a single
form. Loading and unloading the form may take a while but the user will have
some continuity moving between different parts of the data.

Bonnie said:
Hi everyone! Using A02 on XP. I have a HUGE form that works best in 14
sections. On my main form I have a button to open the first form. To run
them in sequence, each form has a Next button to open the forms in a certain
order. However, when I'm done I have a stack of 15 forms open (Main form
plus the 14 sections). What is the best way to close them? All at once from
the 14th segment or as I move from form to form? I put a DoCmd.Close in the
code that opens the next form but get an error message "The expression you
entered referrs to an object that is closed or doesn't exist." Here is my
code. (I get the error after I insert the DoCmd.Close, the rest of it works
fine before the insertion.)

Private Sub Next_Click()
On Error GoTo Err_Next_Click
DoCmd.Close 'I INSERTED THIS LINE
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fPlanAuditSub02SPY"

stLinkCriteria = "[AuditID]=" & Me![AuditID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Next_Click:
Exit Sub

Err_Next_Click:
MsgBox Err.Description
Resume Exit_Next_Click

End Sub

On the form above, I want to be able to open fPlanAuditSub02SPY and close
fPlanAuditSub01Census.

Looking for advice on how best to do this. Thanks in advance for any help.
 
K

kingston via AccessMonster.com

You're welcome. I'm glad I could be of help.

Bonnie said:
Hi Kingston! Wanted to thank you VERY much for the info and super fast
response. I knew it was a simple thing but had the logic wrong. I did
consider tabs for a sec but have heard bad things about them. Thanks again
for your help!!! Thanks for being a teacher in these newsgroups.

P.S. It works GREAT!
Use the next form's On Open event to close the previous one:
DoCmd.Close acForm,"Last Form"
[quoted text clipped - 38 lines]
 

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

Top