Solved

Accessing Read-only MDB Files

Posted on 2001-06-24
5
181 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
  • 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA color chart bars 12 86
VBA filters 2 61
using web browser with BING 40 120
Child Form in front 4 47
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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

773 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