If the program does not explicitly close all the data access objects (by using db.close, for example), then the error will occur when the second instance of the program tries to work with a data access object.
Dim db As database
Dim ds As dynaset
Dim sn As snapshot
Dim tb As table
Set db = OpenDatabase("<some database file>")
Set ds = db.CreateDynaset("<some query>")
Set sn = db.CreateSnapshot("<some query>")
Set tb = db.OpenTable("<some table name>")
execute the following close statements before the program ends:
NOTE: If you place the .Close methods in the Unload or QueryUnload events, make sure you invoke these events before your program ends by using the Unload statement (for example, Unload Me). Be careful when using the End statement; it does not invoke the Unload or QueryUnload events.
Steps to Reproduce Problem
- Start Visual Basic and open the VISDATA.MAK project located in the \VB\SAMPLES\VISDATA directory (ALT, F, O).
- From the File menu, choose Make EXE File to create an executable.
- Exit Visual Basic, and run File Manager.
- Change directories to the \VB\SAMPLES\VISDATA directory and double-click VISDATA.EXE to run the program. Repeat this step so that two instances of VISDATA are running.
- In both instances of VISDATA, open the BIBILIO.MDB database located in your Visual Basic directory \VB.
- Close one instance of VISDATA.EXE.
- Start another instance of VISDATA.EXE and try to open the BIBLIO.MDB database again. You will get Error 3043 - "Disk or Network Error."
ID articolo: 114771 - Ultima revisione: 17 giu 2014 - Revisione: 1