Access Command Line Switch using hyperlink?


S

Suzie H.

What is the syntax to use WITHIN an email that will pass the /cmd
value?

I can get the value to pass when using the Run dialog box, but I have
not been able to get it to work as a hyperlink from within an email.

This does not work:
<file://C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE C:
\Documents and Settings\user\Desktop\MyDatabase.mdb /cmd 27>

Can you help?

Suzie H.
 
Ad

Advertisements

A

Arvin Meyer [MVP]

You're almost there. You need some quotes, and a function which will run
when the database opens. Here's some info from the Access 97 help files
which may be of use:

The following example shows how to launch Microsoft Access with a
command-line argument, then shows how to return the value of this argument
by using the Command function.
To test this example, click the Windows Start button and click Run. Type the
following in the Run dialog box, on a single line. (You must surround the
parts of the command line information in quotation marks).

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" "C:\Program
Files\Microsoft Office\Office\Samples\Northwind.mdb" /cmd "Orders"

Next, open a new module in the Northwind sample database and add the
following function.

Function CheckCommandLine()
' Check value returned by Command function.
If Command = "Orders" Then
DoCmd.OpenForm "Orders"
ElseIf Command = "Employees" Then
DoCmd.OpenForm "Employees"
Else
Exit Function
End If
End Function

When you call this function, Microsoft Access will open the Orders form.
 
S

Suzie H.

You're almost there. You need some quotes, and a function which will run
when the database opens. Here's some info from the Access 97 help files
which may be of use:

The following example shows how to launch Microsoft Access with a
command-line argument, then shows how to return the value of this argument
by using the Command function.
To test this example, click the Windows Start button and click Run. Type the
following in the Run dialog box, on a single line. (You must surround the
parts of the command line information in quotation marks).

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" "C:\Program
Files\Microsoft Office\Office\Samples\Northwind.mdb" /cmd "Orders"

Next, open a new module in the Northwind sample database and add the
following function.

Function CheckCommandLine()
 ' Check value returned by Command function.
 If Command = "Orders" Then
  DoCmd.OpenForm "Orders"
 ElseIf Command = "Employees" Then
  DoCmd.OpenForm "Employees"
 Else
  Exit Function
 End If
End Function

When you call this function, Microsoft Access will open the Orders form.

--
Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com










- Show quoted text -

Thank you, I appreciate your effort in helping me!

My problem is creating a **Hyperlink** that I can put in an email that
will do the same thing. When I use the "correct" syntax nothing
happens when clicking the hyperlink in a sent email yet the same
syntax when placed in the Run Dialog box works fine and I can read
the /cmd value using the Command() function.

What is the syntax for a hyperlink i can put in an email that will
pass the /cmd value to Access?

This does not work correctly *When Used As A Hyperlink In An Email*:
<file://"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:
\Documents and Settings\user\Desktop\MyDatabase.mdb" /cmd 27>

(27 is an example of a value I want to pass)

It does not open access. Removing the quotes at least gives me an
error messag: Cannot find file... make sure the path or internet
address is correct

I am hoping you can help.
 
A

Arvin Meyer [MVP]

My problem is creating a **Hyperlink** that I can put in an email that
will do the same thing. When I use the "correct" syntax nothing
happens when clicking the hyperlink in a sent email yet the same
syntax when placed in the Run Dialog box works fine and I can read
the /cmd value using the Command() function.

What is the syntax for a hyperlink i can put in an email that will
pass the /cmd value to Access?

This does not work correctly *When Used As A Hyperlink In An Email*:
<file://"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:
\Documents and Settings\user\Desktop\MyDatabase.mdb" /cmd 27>

(27 is an example of a value I want to pass)

It does not open access. Removing the quotes at least gives me an
error messag: Cannot find file... make sure the path or internet
address is correct
 
S

Suzie H.

My problem is creating a **Hyperlink** that I can put in an email that
will do the same thing.  When I use the "correct" syntax nothing
happens when clicking the hyperlink in a sent email yet the same
syntax when placed in the Run Dialog box works fine and I can read
the /cmd value using the Command() function.

What is the syntax for a hyperlink i can put in an email that will
pass the /cmd value to Access?

This does not work correctly *When Used As A Hyperlink In An Email*:
<file://"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:
\Documents and Settings\user\Desktop\MyDatabase.mdb" /cmd 27>

(27 is an example of a value I want to pass)

It does not open access.  Removing the quotes at least gives me an
error messag: Cannot find file... make sure the path or internet
address is correct

---------------------------------------------------------------------------­----------
Try each segment using Start >>> Run and pasting into the command window.

Also: /cmd27 will not work, it should read: /cmd "27" That is: Forward
slash, cmd, and 27 in quotes.

Arvin, you have been very helpful, but I am hoping you will help me
with my real problem.
In an EMAIL what is the syntax for a HYPERLINK that will do the same
thing?

If you try create an EMAIL HYPERLINK with the syntax you suggest it
does not work. I am hoping you can suggest an EMAIL HYPERLINK that
will open Access and pass a value using the /cmd switch.

I am not having any problem making this work using a desktop short cut
or using the Start --> Run dialog.
This works perfectly fine: "C:\Program Files\Microsoft Office
\OFFICE11\MSACCESS.EXE" "C:\Documents and Settings\dkamin1\Desktop
\CardPrintRequest.mdb" /cmd 27

I need help creating an EMAIL HYPERLINK that will open Access and pass
a value. I do not need any help at this time to understand how to
retrieve this value from access or how to open a record once I get the
value.

Once again, thank you for your help. I know I am getting free help.
I do appreciate that. Anything you can suggest will be helpful.
 
A

Arvin Meyer [MVP]

If the desktop shortcut works, try attaching it to your email. If it still
doesn't work, either the file can't be found (i.e. drive mappings could be
different) or possibly something in your email app is blocking you.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Arvin, you have been very helpful, but I am hoping you will help me
with my real problem.
In an EMAIL what is the syntax for a HYPERLINK that will do the same
thing?

If you try create an EMAIL HYPERLINK with the syntax you suggest it
does not work. I am hoping you can suggest an EMAIL HYPERLINK that
will open Access and pass a value using the /cmd switch.

I am not having any problem making this work using a desktop short cut
or using the Start --> Run dialog.
This works perfectly fine: "C:\Program Files\Microsoft Office
\OFFICE11\MSACCESS.EXE" "C:\Documents and Settings\dkamin1\Desktop
\CardPrintRequest.mdb" /cmd 27

I need help creating an EMAIL HYPERLINK that will open Access and pass
a value. I do not need any help at this time to understand how to
retrieve this value from access or how to open a record once I get the
value.

Once again, thank you for your help. I know I am getting free help.
I do appreciate that. Anything you can suggest will be helpful.
 
Ad

Advertisements

C

cdiltz

I am trying to do the same thing, pass a value into Access when I start it.
I am using /cmd and the value makes it into Access, show in
Tools\Options\Advanced tab in the field Command-line arguments.

I am trying to use "=Command() " on a text box on a form to get the value.
I have also tried to use the code below on startup to see I have the value.

In either method I get the message
" The expression you entered has a function name that Microsoft Office
Access cannot find."

Thoughts????


STARTUP CODE:
Function CheckCommandLine()

Dim ItemNumberText As String
ItemNumberText = Command.Value

MsgBox ("item: " & ItemNumberText)
Exit Function
End Function
 
Ad

Advertisements

S

Skihard4

Arvin, any luck here?

I am at the same point you are. I can get everything to work through the
start / run test process.

As soon as I have my SendObject action from my macro put the link into the
body of the message.

"C:\Program Files\Microsoft Office\OFFICE11\Msaccess.exe"
"\\14-file-001\Vactor\Public\_QUALITY\Databases\Empty_FivePhase\FivePhase2K3.mdb" /cmd "3"

As the e-mail comes to my inbox, the link ignores the /cmd "3" part of the
syntax.

I too am looking for the proper way to put this link into the body of the
message.

Thanks to all for any help.
 

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