Solved

Limiting DAO Access

Posted on 1999-01-20
2
170 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
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now