For smaller labeling systems, Excel is often used as a database due to its simplicity. Under certain conditions, however, Windows can lock the file preventing other users from accessing it. A file in a ‘locked’ state can stop CODESOFT from accessing it.
- The CODESOFT label design is configured to connect to Excel
- User receives and error when opening the label file
This is a file locking situation. If the label file is open and the OLEDB connection is set with write or modify access it will open the associated Excel document in an exclusive mode – meaning no one else could open the file for update. Since Excel is not a true database, Windows needs to protect the file from corruption by only allowing one user at a time to alter it. Thus, Windows locks the file for editing. If the file is already opened by another program (Excel), the label file will fail during opening because it cannot obtain an exclusive lock on the file.
A couple of potential solutions:
- Modify the OLEDB Settings to ‘Read-Only’ Mode – this should prevent Windows from locking out CODESOFT (other applications may still be locked out).
- Connect CODESOFT to a Fully Functional Database Server (e.g. SQL) – using a fully functional database server avoids the locking of files since the database server can manage multiple connections.
In the label design, set the database connector to read-only mode.
- Data source/Database/Create Edit Query
- Select OLEDB from the “New” button
- Select the connection that is associated with the Excel document and click Edit
- Select Advanced tab
- In Access permissions, clear all the check mark except for the one for ReadClick OK,
This is a better long term solution but does involve moving the data to a SQL database (SQL Express is OK for this). If the user is familiar with Excel, it can be configured to allow the user to work within Excel to save data into the SQL database instead of a typical Excel file.
Enter additional comments here