VB4,opening database w/o write access to file 
Author Message
 VB4,opening database w/o write access to file



Quote:
> I wrote a simple program that just accesses an Access2 db.  I don't won't
> anyone to have write access to the files in the directory, they just read
> the data and print a report (Crystal Report).

> So I only gave them Read and File Scan rights to the directory.  But when
> they try to open it (non-exclusive, read-only) it tells me it can't lock
> the file.  The only way i've been able to make it work is to give them
> Write access to the file/directory.  That defeats the purpose because, if
> they have a db program that can use .mdb files, they can change the data.

> Any ideas?  I've been out of programming for awhile, so maybe I'm just
> doing something (else ;) stupid

Why not open the recordset as a snapshot, so that the output is read-only,
but the file itself is not locked? (If you need to protect the file itself,
you could always store it on a secure file system...)

dim ws as workspace, db as database
dim rs as recordset

set ws=dbengine.workspaces(0)
set db=ws.opendatabase([path to database])
set rs=db.openrecordset([tablename], dbOpenSnapshot)
...

HTH,

--
Dan McGarry



Tue, 25 Jan 2000 03:00:00 GMT  
 VB4,opening database w/o write access to file



Quote:
> I wrote a simple program that just accesses an Access2 db.  I don't won't
> anyone to have write access to the files in the directory, they just read
> the data and print a report (Crystal report).

> So I only gave them Read and File Scan rights to the directory.  But when
> they try to open it (non-exclusive, read-only) it tells me it can't lock
> the file.  The only way i've been able to make it work is to give them
> Write access to the file/directory.  That defeats the purpose because, if
> they have a db program that can use .mdb files, they can change the data.

Your problem here is that you're using trying to use network security to
secure your database.  You'll have a lot more success if you use database
security to do this.

What you'll want to do is secure the database so that your users -
specifically, the VB application that they're running - have read-only
access to its objects.  This isn't difficult, but it isn't straightforward
either.  Rather than trying to figure it out from the help files, check out
the Microsoft knowledge base; there is a very useful article in it about
how to secure an Access 2.0 database.  (Don't know its article ID, alas.)

Bob Rossney



Tue, 25 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB4,opening database w/o write access to file

2. VB4,opening database w/o write access to file ....SOLUTION

3. URGENT: need to open an Access 95 database from VB4-16

4. URGENT: need to open an Access 95 database from VB4-16

5. VB4 app opening Secure 2.0 and 7.0 Access Databases concurently

6. Problem on open access 2.0 database by VB4

7. How To open Security Enabled Access DataBase in 16 bit VB4

8. URGENT: need to open an Access 95 database from VB4-16

9. URGENT: need to open an Access 95 database from VB4-16

10. can't open an Access database in CD-R (VB4)

11. Open password protected Access Database from VB4

12. Help to Open an Access 7.0 Database from VB4

 

 
Powered by phpBB® Forum Software