Kamis, 19 September 2013

RE: [MS_AccessPros] RE: Error message "Unable to open any more Databases"

 

You're welcome, Rod. If you are doing any action that affects another object it's best to close the first object after the other actions. Otherwise, the first object could hang as it attempts to close itself and still run code.

 

Regards,

Bill

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of desertscroller@cox.net
Sent: Wednesday, September 18, 2013 6:40 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] RE: Error message "Unable to open any more Databases"

 

 

Thanks Bill, After testing the new code, I  compacted the database.  Prior to compacting the DB, I used your code to Turn off SubDatasheets.  Reran the application with no errors.  I will be looking further into the issue but at this time everything is great.

 

Thanks again Bill.  I thought it was better to close the report prior to opening another form (form only has command buttons to access other activities.

 

Rod



--- In ms_access_professionals@yahoogroups.com, <wrmosca@...> wrote:

Rod

 

Now we've at least pinned it down to an error in the form. Does the form have any code or macro in the Open or Load event? Can you also post the SQL statement for the form's RecordSource? Something is trying to force the form to do some action that it can't do.

 

Bill  



--- In MS_Access_Professionals@yahoogroups.com, <ms_access_professionals@yahoogroups.com> wrote:

Hi Bill, I tried the suggestion.  The form opens but the error message "No current record" still appears.  When I click on the "OK" button the report closes.  Could this be caused by one of the sub reports not closing properly?  I know I could trap the error then ignore it but that doesn't seem as proper programming especially with error handling.

Thanks for the time you providing.

Rod



--- In ms_access_professionals@yahoogroups.com, <wrmosca@...> wrote:

Rod

 

Trying to open the form after the report's Close event is probably causing the error. Let's simplify the code a bit and switch the order of the commands.

 

Try this:

 

 Private Sub Report_Close()

   On Error GoTo Report_Close_Err

   DoCmd.OpenForm "frmRptSysDialog" 

   DoCmd.Close acReport, "Rpt_Composite"

      

  Report_Close_Exit:

      Exit Sub

  Report_Close_Err:

      MsgBox Error$

      Resume Report_Close_Exit

End Sub 

 

 

Bill



--- In MS_Access_Professionals@yahoogroups.com, <ms_access_professionals@yahoogroups.com> wrote:

Bill, after trying the macro as you suggested everything worked great.  When I went to convert the macro to a procedure  as follows (I get one of two errors):

 

 Private Sub Report_Close()
   On Error GoTo Report_Close_Err
      DoCmd.Close acReport, "Rpt_Composite", acSaveNo
      DoCmd.OpenForm "frmRptSysDialog", acNormal, "", "", , acNormal
  Report_Close_Exit:
      Exit Sub
  Report_Close_Err:
      MsgBox Error$
      Resume Report_Close_Exit
End Sub

 

With acSaveNo on the Close command error "The Close action was canceled"

Without acSaveNo the error is "No current record"

 

Did I miss something in converting the macro?

Rod



--- In ms_access_professionals@yahoogroups.com, <wrmosca@...> wrote:

Rod

 

Glad I could hale. I don't think I've used more than 2 or 3 macros in my entire career. If you are comfortable with converting it to code I'd say go ahead.

 

Regards,

Bill

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of desertscroller@...
Sent: Wednesday, September 11, 2013 7:05 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] RE: Error message &quot;Unable to open any more Databases&quot;

 

 

Thanks Bill, that did the trick.  I was thinking of converting macro to procedure to handle errors better.

 

Rod



--- In ms_access_professionals@yahoogroups.com, <wrmosca@...> wrote:

Rod

 

In your macro, did you specify the report by name.  If the report loses focus the macro won't close it.

 

Regards,

Bill Mosca, Founder - MS_Access_Professionals

http://www.thatlldoit.com

Microsoft Office Access MVP

https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E

My nothing-to-do-with-Access blog

http://wrmosca.wordpress.com

 



--- In MS_Access_Professionals@yahoogroups.com, <ms_access_professionals@yahoogroups.com> wrote:

Thanks Clive, I am working on trying the two suggestions.  I will be looking at Bill's utility very closely, it may provide the best solution.  If you don't mind I have one other question.  When the report is run with one company the results look correct but when I try to close it, I get a Macro Single Step popup.  The Action being taken is CloseWindow with error number 3021.  The Stop All Macros is active and when selected the report closes.  In the Macro, I have CloseWIndow, OpenForm and StopMacro statements.  Any suggestions?

Rod

 


--- In ms_access_professionals@yahoogroups.com, <zctek@...> wrote:

Hi Rod,

You can also download a utility from Bill Mosca's website,
that You can use it to remove some redundant indexes.
http://www.thatlldoit.com/Pages/codesamples.aspx

It is called TurnOffSubDataSheets and it changes the
tables Subdatasheet_Name property from [auto] to [none]
and it tells you how many tables have been modified.

You only need to run it once for existing tables or
if you add new tables.

Hope that helps.

Regards, Clive.

--- In MS_Access_Professionals@yahoogroups.com, "Clive" <zctek@...> wrote:
>
> Hi Rod,
>
> The message "Unable to open any more Databases" really means
> "Too many Indexes in use".
>
> You can remove unnecessary indexes in the Tables used but
> if that fails then use your suggestion and create
> Temporary Tables for intermediate results.
>
> Regards, Clive.
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (13)
.

__,_._,___

Tidak ada komentar:

Posting Komentar