Solved

Limiting DAO Access

Posted on 1999-01-20
2
183 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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