If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Closing Forms After Opening A Report
I'm having a strange problem involving forms that open
forms. I can only describe it as follows: I have 3 forms (Form A, B, and C) and 2 reports. Form A is a "main" form that opens Form B or Form C. Form B can open a report and Form C can open a report. Both Form B and C have listboxes that the user can select from and then use the selection to open and fill a report for printing. Here's how Form A opens the other forms: DoCmd.OpenForm "B", acNormal, , , , acDialog Here's the problem... If I open Form B and then close it without opening a report, I can go on to open Form C and everything works fine. On the other hand, if I open Form B, open a report, and then close Form B, my attempt to open Form C results in Form B opening again. If I close Form B after this unexpected visit, then I can go on to Form C as before. Opening the report is what makes things go wrong. This is also the case if I first open Form C, open a report, close Form C, and then try to open Form B. I re-visit Form C unexpectedly. Here's how I close each form... DoCmd.Close acForm, "C", acSaveNo Here's how I open a report (for immediate print without a preview)... DoCmd.OpenReport "MyReport", acViewNormal Does anybody have any idea why opening a report from either Form B or C causes the close sequence to get messed up? Thanks, Roger |
#2
|
|||
|
|||
Two things strike me:
1. The "dialog" parameter of your form open command, causes all code execution to halt until you respond. Perhaps changing to a pop-up and/or modal form would work as well. 2. If your running the close form code from the form you wish to close, then just "DoCmd.Close" will do. Not sure why you'd not want to save data changes on close. -Ed "Roger Lord" wrote in message news:CAbTd.3010$Az.540@lakeread02... I'm having a strange problem involving forms that open forms. I can only describe it as follows: I have 3 forms (Form A, B, and C) and 2 reports. Form A is a "main" form that opens Form B or Form C. Form B can open a report and Form C can open a report. Both Form B and C have listboxes that the user can select from and then use the selection to open and fill a report for printing. Here's how Form A opens the other forms: DoCmd.OpenForm "B", acNormal, , , , acDialog Here's the problem... If I open Form B and then close it without opening a report, I can go on to open Form C and everything works fine. On the other hand, if I open Form B, open a report, and then close Form B, my attempt to open Form C results in Form B opening again. If I close Form B after this unexpected visit, then I can go on to Form C as before. Opening the report is what makes things go wrong. This is also the case if I first open Form C, open a report, close Form C, and then try to open Form B. I re-visit Form C unexpectedly. Here's how I close each form... DoCmd.Close acForm, "C", acSaveNo Here's how I open a report (for immediate print without a preview)... DoCmd.OpenReport "MyReport", acViewNormal Does anybody have any idea why opening a report from either Form B or C causes the close sequence to get messed up? Thanks, Roger |
#3
|
|||
|
|||
That did the trick!
Thanks much, Roger "Ed Robichaud" wrote in message ... Two things strike me: 1. The "dialog" parameter of your form open command, causes all code execution to halt until you respond. Perhaps changing to a pop-up and/or modal form would work as well. 2. If your running the close form code from the form you wish to close, then just "DoCmd.Close" will do. Not sure why you'd not want to save data changes on close. -Ed "Roger Lord" wrote in message news:CAbTd.3010$Az.540@lakeread02... I'm having a strange problem involving forms that open forms. I can only describe it as follows: I have 3 forms (Form A, B, and C) and 2 reports. Form A is a "main" form that opens Form B or Form C. Form B can open a report and Form C can open a report. Both Form B and C have listboxes that the user can select from and then use the selection to open and fill a report for printing. Here's how Form A opens the other forms: DoCmd.OpenForm "B", acNormal, , , , acDialog Here's the problem... If I open Form B and then close it without opening a report, I can go on to open Form C and everything works fine. On the other hand, if I open Form B, open a report, and then close Form B, my attempt to open Form C results in Form B opening again. If I close Form B after this unexpected visit, then I can go on to Form C as before. Opening the report is what makes things go wrong. This is also the case if I first open Form C, open a report, close Form C, and then try to open Form B. I re-visit Form C unexpectedly. Here's how I close each form... DoCmd.Close acForm, "C", acSaveNo Here's how I open a report (for immediate print without a preview)... DoCmd.OpenReport "MyReport", acViewNormal Does anybody have any idea why opening a report from either Form B or C causes the close sequence to get messed up? Thanks, Roger |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Making a report open in front of all other open forms | cindyn | Setting Up & Running Reports | 7 | January 30th, 2005 06:51 AM |
Connection Error on opening the report | Prat | Setting Up & Running Reports | 0 | December 24th, 2004 05:39 PM |
Still Hoping for help with a Query problem | Don Sealer | Using Forms | 15 | November 13th, 2004 06:24 AM |
combo box select when opening report | Pasquale | New Users | 2 | August 27th, 2004 01:28 PM |