Set Database to "Read-Only" using the startup macro

G

Guest

I'm using Access 2000. Help says I can use a command line function "/ro" to
set my database to read only using the "RunCode" drop down in my start up
macro. I don't know code, so I don't know what to type in the "Function" box
that appears. Can anyone help me?

I don't want anyone else to be able to change it back to "read-write". Is
there another way to accomplish this without setting it up with security?
 
R

Rick Brandt

Nancy said:
I'm using Access 2000. Help says I can use a command line function
"/ro" to set my database to read only using the "RunCode" drop down
in my start up macro. I don't know code, so I don't know what to
type in the "Function" box that appears. Can anyone help me?

The command line argument /ro would be used in a shortcut to open your file. It
cannot be used from inside the file after opening. It is too late at that point
to control whether the file is read only or not.
I don't want anyone else to be able to change it back to
"read-write". Is there another way to accomplish this without
setting it up with security?

Put the file into a network folder that has read only perms on the folder (that
will make it read only for everyone though, not just certain people). If you
are distributing the file to each target PC then you cannot prevent the user
from changing the Read only property.
 
G

Guest

Thanks for your reply. I'm afraid I'm pretty illiterate when it comes to
computer programming. Here's the quotes from the Access Help page for Start
Up Command lLine Options.

"/ro Opens the specified Access database or Access project for read-only
access."

"To run a Visual Basic for Applications procedure when you open a database,
use the RunCode action in the AutoExec macro or in the macro that you run by
using the command-line option /x. -"

I thought they were referring to the Auto Exec Macro that is in the database
I created. Can you help me understand more about this Auto Exec Macro they
refer to.

Nancy
 
R

Rick Brandt

Nancy said:
Thanks for your reply. I'm afraid I'm pretty illiterate when it
comes to computer programming. Here's the quotes from the Access
Help page for Start Up Command lLine Options.

"/ro Opens the specified Access database or Access project for
read-only access."

"To run a Visual Basic for Applications procedure when you open a
database, use the RunCode action in the AutoExec macro or in the
macro that you run by using the command-line option /x. -"

I thought they were referring to the Auto Exec Macro that is in the
database I created. Can you help me understand more about this Auto
Exec Macro they refer to.

You are describing two completely different concepts.

Concept 1) Access can be started from a command line or with a shortcut that
includes optional arguments for Access to process. For example, I can specify a
workgroup file to use with the /wrkgrp argument...

"Path to MSAccess.exe" /wrkgrp "Path to MDW" "Path to MDB"

....or I can specify that I want a file to open in read only mode using the /ro
argument...

"Path to MSAccess.exe" "Path to MDB" /ro

....or I can specify that when a file is opened I want a certain macro to be
automatically executed...

"Path to MSAccess/exe" "Path to MDB file" /x MacroName

Concept 2) You can create a macro in Access and name it "AutoExec" and it will
be executed automatically when you open the file.

So...the /ro command line argument can be used to open a file as read only, but
this instruction is given to Access before the file is opened. You cannot
specify that the file be read only in a macro that runs at startup because it is
too late at that point.
 

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