Solved

Limiting DAO Access

Posted on 1999-01-20
2
186 Views
Last Modified: 2013-11-20
I have an Access database from where users need to access information. They do not need to append or edit any information, only read it. I wrote a program using CDaoRecordset for the users to retrieve the information.

The problem is that if I set the mdb file as read only so that users can't delete, add or change the records, the
Open() member function responds "... Cannot open file ...It is already open exclusively by another user."

Only if I give the users read and write access does the program work. But I don't want people to be able to change the database, i.e. with MS Access for example.

Is there a way to do this and get rid of that message.
0
Comment
Question by:santama
[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 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1328060
In CDaoDatabase, there is a method called Open to open a database. One of the arguments to Open is whether to open the database for readonly access. You should specify TRUE for this parameter.

CDatabase::Open
virtual BOOL Open( LPCTSTR lpszDSN, BOOL bExclusive = FALSE, BOOL bReadOnly = FALSE, LPCTSTR lpszConnect = “ODBC;”, BOOL bUseCursorLib = TRUE );
throw( CDBException, CMemoryException );


0
 

Author Comment

by:santama
ID: 1328061
I'm using the following code, and I get the same message.:


Records.Open(dbOpenDynaset, NULL, dbReadOnly);

Where Records is a CDaoRecordset Object.

0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

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