I am using "currentdb.execute sqlstring" to write records to a local table.
I am looping through data that is read from SQL Server.
The error described here happens when I have written 247 records to my local db.
I found that Access has an internal limit of 255 simultaneous connections to Jet.
I have never used currentdb.close or set currentdb =nothing
I tried the currentdb.close after each record was written, but the system still bombs at 247 records.
Any suggestions?
Yeah, you can't close CurrentDB, since it's, well, the current db. ;-)
The code you were running was fine. Seems that the Access bug did cause your code to fail at 255 iterations. I've done what you did many times, going past 255 iterations, and there's no problem usually.
But it seems that applying the Trusted Locations workaround resolved the problem for you. So that's great!
One thing I'll note: you should always use dbFailOnError when using the execute method, so that you'll know if there's an error, i,.e.:
CurrentDB.Execute sqlstring, dbFailOnError