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.