Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read-Only 2

Status
Not open for further replies.

sdb0812

Programmer
May 29, 2003
14
US
We have an Access database in our office that we are trying to put onto a cd(small database). Everything that has been tried thus far has resulted in the database being opened in read-only mode when executed from the cd. How can we make the cd version of the database open in the regular mode?

Scott
 
I am not trying to use the database on the cd, I am just using the cd as a medium to move the database. When I copy the db off of the cd onto another computer, it is in read only mode.

Did you mean that this can't be done?

thanks,
Scott
 
The software that copies files to a CD sets the read only flag on so that other programs will not try to edit files while on the CD.

When you copy onto a hard drive yo must reset the flag yourself.
 
I have nearly the opposite question. I would like to make a couple of tables in an Access package "read only". Can it be done? And if so, easily?

Thanks for any help.

Bob
 
If it can be done it would be through the Access security model which is quite complex and has pitfalls. As that is not my area of expertise you would be better opening a new thread if someone else does not step in quickly.
 
Hi, paste this into the declarations section of a new or existing module:

Declare Function SetFileAttributes Lib "kernel32.dll" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
Public Const FILE_ATTRIBUTES_ARCHIVE = &H20
Public Const FILE_ATTRIBUTES_HIDDEN = &H2
Public Const FILE_ATTRIBUTES_NORMAL = &H80
Public Const FILE_ATTRIBUTES_READONLY = &H1
Public Const FILE_ATTRIBUTES_SYSTEM = &H4

To make a File Read Only, paste this behind a Button on a Form:

Dim lngAttributes As Long, strFile As String
strFile = "c:\my documents\Test.mdb"
lngAttributes = FILE_ATTRIBUTES_ARCHIVE Or FILE_ATTRIBUTES_READONLY
Call SetFileAttributes(strFile, lngAttributes)

To make a File Normal, paste this behind a Button on a Form:

Dim lngAttributes As Long, strFile As String
strFile = "c:\my documents\Test.mdb"
lngAttributes = FILE_ATTRIBUTES_ARCHIVE Or FILE_ATTRIBUTES_NORMAL
Call SetFileAttributes(strFile, lngAttributes)

Bill
 
In regards to the cd software setting a flag...do I need to use some sort of cd burning software to "uncheck" this read only condition or use Access. The reason I ask is the only burning software we have is on one computer and the rest can read what is burnt, but they can not burn themselves. This means, I will have to use the computer that burnt the cd to "uncheck" this condition. Do you know off the top of your head how to do this(I have never heard of it)?

Thanks Cheerio,

Scott
 
I use InstallShield to copy the database (and other files) off of the CD. This automagically removes the Read Only flag for me.
 
1. just copy the mdb/mde file off the cd
2. right click on the mdb/mde file that u saved onto the hard disk
3. select properties
4. uncheck the box marked 'read only'
 
i always do exactly what daneharnett said, and have never had a problem.
 
That fixed it...I appreciate everyone's help in this trivial, yet frustrating problem.

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top