Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot open any more databases ?

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
US
Hi,
I have 2 recordsets Rs1 and RS2.

do while not rs1.eof
---
rs2.open sql,currentproject.connection
do while not rs2.eof
------
loop

loop

rs1 is returning 241 records. So after 125 records are so, its breaking up saying "cannot open any more datbases" and stopping at
rs2.open sql----
what should i do ?
please help
thanks
RK
 
It seems as if every time you reach the line rs2.open sql,currentproject.connection, a new connection is made.

Put a command line above the outer loop that says:
Set cnnDb = currentproject.connection

Replace rs2.open sql,currentproject.connection by rs2.open sql, cnnDb

Then rs2 points every time to the same connection with your db. I think you could do the same for rs1

cnndb must be a variable of type ADODB.Connection.
Add some security to your recordsets rs1 and rs2.

Try it out, I haven't, it's my intuition saying this is what's happening.

Good luck, Bart Verlaan.
 
Is there a rs2.Close command between the two loop commands?
If not, I think it's worth the try.

Good luck. Bart V.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top