Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Limiting DAO Access

Posted on 1999-01-20
2
Medium Priority
?
187 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

722 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