Error using CurrentDB() method

J

Johnh

Can someone help me understand why I'm getting a run-time error 3048 - Cannot open any more databases?
I am using Access 2002

Private Sub Form_Current(

Me.txt_Unmatched = Me.CHKDAT_Am

Dim Updt_frm_match_ind As Strin
Dim Mydb3 As Databas

Updt_frm_match_ind = "UPDATE tbl_AP_multi_txn_must_match_manually SET "
& "tbl_AP_multi_txn_must_match_manually.frm_match = No WHERE "
& "(((tbl_AP_multi_txn_must_match_manually.frm_match)=Yes) AND "
& "((tbl_AP_multi_txn_must_match_manually.[Txn Clear Date]) Is Null));

Set Mydb3 = CurrentDb() <== break occurs her

I don't get this problem with a different form in the same database:....

Private Sub Form_Current(

Dim Delete_Cat_List As String, Add_Cat_List As Strin

Delete_Cat_List = "DELETE tbl_frm_Picklist_Category_Filtered.* FROM tbl_frm_Picklist_Category_Filtered;

Add_Cat_List = "INSERT INTO tbl_frm_Picklist_Category_Filtered SELECT Category FROM tbl_Group_and_Category" &
" WHERE [Group]='" & Me.Group & "';

Dim Mydb As Databas
Set Mydb = CurrentDb(
Mydb.Execute Delete_Cat_Lis
Mydb.Execute Add_Cat_Lis
DoCmd.Requery "Category

End Su

Thanks for any help that can be provided!
 
S

Sandra Daigle

Hi John,

This error means that you have run out of tableids for open tables. There is
a limit to the number of "tables" that can be open at any one time. In
Access 2002 the limit is 2048. In this context if you have a single table
open in table view you are using 1 tableid, if you have an open query based
on 3 tables, you have used 3 tableids. If you have a form based on the query
and the form has a combo based on a single table, you have 4 tableids (I
think). If the tables are actually linked tables I think it uses at least
one additional table id for each linked table.

Obviously there is no easy way to monitor how many tableids are actually
assigned at any given time. This is tracked internally and not exposed to
the developer. Your only indication is when you get this error. So . . . how
to fix your problem? Look carefully at the form that is giving you trouble.
Is it a complex form with many subforms organized on a tab control? Look for
ways to release some of those open queries and recordsets when they are not
needed. Also, make sure that you are destroying all db object variables when
they are no longer needed.

Also take a look at the following article which explains the problem which
results in a different but similar error.

ACC: Error Message: Can't Open Any More Tables
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q165272
 

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

Similar Threads

Requery after you modify the SQL statement in VBA Access? 3
multi-select list box 1
VB Error 2
Inserting not working 1
Insert Into problem 3
ms ACCESS 97 error 2645 1
Query using 3 listboxes 1
Database fault 9

Top