Solved

Accessing Read-only MDB Files

Posted on 2001-06-24
5
203 Views
Last Modified: 2012-08-13
I am trying the situation wherein a database reads
a mdb file from a CD-ROM (in which case the MDB file property is set as read-only and archive). I need to use ADO to open it but it generates errors (because the file
is read only). How do I get around so my database can
still read files from CD-ROM
0
Comment
Question by:rqs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 6223399
I don't think it is possible. When a mdb file is read, it will create a lock file in the same directory. Since CD is read-only, there will have a problem.

The only way is to copy the file onto local harddisk and then read it. After reading it, delete it.

I will stay here to see more comments and learn from it.

hongjun
0
 
LVL 2

Expert Comment

by:nahumd
ID: 6223530
Even if the mdb is set to read-only on the local hard disk, I still think that you can't open it (although it can write the lock file).
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6223538
You can open it but you can only read cannot update.

hongjun
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6224085
You have to open the MDB for exclusive single user use only. This does not require the .ldb (locking) file to be created.

   Dim con as new ADODB.Connection
   con.Provider = "Microsoft.Jet.Oledb.3.51" ' or jet 4 if required.
   con.Mode = adShareDenyWrite
   con.Open "Data Source=E:\testdb.mdb"

0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6224087
You have to open the MDB for exclusive single user use only. This does not require the .ldb (locking) file to be created.

   Dim con as new ADODB.Connection
   con.Provider = "Microsoft.Jet.Oledb.3.51" ' or jet 4 if required.
   con.Mode = adShareDenyWrite
   con.Open "Data Source=E:\testdb.mdb"

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month3 days, 15 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question