OpenDatabase recommended practise

L

Laurence Lombard

OpenDatabase recommended practise

I have an excel spreadsheet that accesses a database with the following
typical sequence
Set db = OpenDatabase(Range("dbFullName").Value) 'opens the database
Set rst = db.OpenRecordset("Statements") 'opens the Table
'read, edit or add records
rst.Close
db.Close

Now it happens from time to time that I get an error message "file
locked for editing". From some internet research I have checked the
properties of the file or folder and I see it is not "read only", which
has been the normal published problem. Other times I get a message that
the database/recordset is already open.

My question is: Should one open the database on opening of the Excel
workbook and rather leave it open until you close the workbook, or
should you open and close the db and rst everytime you access the database.

Many thanks
Laurence
 

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

Top