Making mdb read-only after appending tables

S

scorpiosting_ouch

Hi,

I have created an Access mdb(2003) through VB6 code using ADOX (2.8).
All tables in this db are being populated through code in the front
end. (Data for this is coming from flat files.)

The mdb has to be deleted after processing is finished. I am able to
open the db and modify data even as the program is running. I need to
find a way to prevent a user from opening and modifying it.

I tried created the tables with the property: newTbl.Properties("Jet
OLEDB:Table Hidden In Access") = True
But the tables still show if with the "Hidden" option checked and data
can be modified.

Using "Access.Application.SetHiddenAttribute acTable, strTableName,
True" also has the same result.

I cannot define the connection object for the ADOX Catalog as
read-only, since the tables are being created and appended to the mdb
dynamically. Is there any way by which I can make the mdb itself
hidden, or make the mdb read only after all tables are appended and
populated?

I did consider creating users for the database like this and then
appending it to a group:
newCat.Users("Admin").SetPermissions strDataBase, adPermObjDatabase,
adAccessGrant, adRightRead
But it throws runtime error 3265. More over, there are really no users
for this database except for the front end, and that too only for the
period that the program runs. The mdb file will be deleted at the end
of the whole thing.

I'm new to programming using Access. Any help and patience with this is
highly appreciated.

Thanks in advance,
Anu
 
D

david epsom dot com dot au

I don't know how to do this in ADO, but using a dao
database object:

db.TableDefs("table1").attributes = 1

makes the table invisible in Access even if hidden
objects are visible.

Originally, this attribute was used for temp objects,
like the temp querydefs created by Access for SQL
associated with a form object instead of a saved query
object. Temp objects are deleted when the database is
compacted.

But VB programmers were confused by the name of the
attribute, (dao.dbHiddenObject), so apparently, with
Jet 4.0, Microsoft changed the meaning of this attribute
to match what VB programmers always thought it 'should'
be - a permanent object not visible in Access.

That is, objects with this attribute are never visible
in Access, and, apparently, are not deleted when the
database is compacted.

There may be a way to set this property using ADO.

The methods you have tried refer to the Access Hidden
property, which is a different thing.

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top