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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you reference a form in a shell command?

Status
Not open for further replies.

wynoski

Technical User
Aug 22, 2002
5
0
0
US
Hi. This is the scenario: I have a db which launches a Main Menu upon entry using an autoexec macro. The Main Menu allows the user to open various different forms. However, some users would prefer to forego having to drill down using the Main Menu to get to a form they use on a regular basis (plus, they don't use any of the other forms listed on the Main Menu). Is there a way I can create a special shortcut for these individuals which overrides the autoexec macro and opens up the form they are interested in?

I tried having a separate db for them that only contains an autoexec macro with a shell command to open the desired db, but this launches the desired db's autoexec (and thus the Main Menu). Is there a way I can reference the form in the shell command?

I should also mention - I'm interested in making the db an mde file for several reasons, so creating a shortcut to form itself (by dragging the form icon to the desktop) is not an option.

Any thoughts on how I might be able to do this?

Thank you much!
 
You could create a macro for each user.
Then each user could double-click a 'personal' shortcut' with the target:

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\My Documents\DnAccessOutlook.mdb" /x macroname

Is that what you need?

Dan
[pipe]
 
Hey Dan. Thanks for the quick reply. I tried modeling my shell command after the example you gave but I am not having any success. Not sure where to place the Macro reference and in what syntax. I've attached the code to a command button. The name of the macro I want to execute in db2 is Macro1.

Here is my code without the macro reference:

'------------------------------------
Private Sub Command0_Click()

Dim x1 As Integer
Dim DocName1 As String

DocName1 = "C:\Program Files\Microsoft Office\Office\Msaccess.exe" & " C:\AccessTest\db2"
x1 = Shell(DocName1, 1)

End Sub

'-----------------------------------

I assume from the example you gave above that the reference to the macro would come after the "C:\AccessTest\db2", but not sure how to code it. I've tried any which way imaginable with no success... help!

Thanks again - your help is much appreciated!

Wynoski
 
Shell ("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" & " " & Chr(34) & "C:\Path\YourDatabase.mdb" & Chr(34) & " /x yourmacroname")

It's in one line.

I tested it and it works.

Dan
[pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top