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

custom toolbar to open docs not in access

Status
Not open for further replies.

itauditor

Technical User
Jan 8, 2001
16
US
I have figured out how to build a custom toolbar that opens tables, queries, and forms within the access database. But how do I program buttons that will open word and excel docs related to that database but not IN the database?? Thanks.
 
Use the following command to open another app, and then open a required file. I have used this to open another db, also specifying a workgroup file.

You can also use the "Run App" function in a macro.



Call Shell("""C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"" ""C:\Program Files\Med Info Manager\Med Info Manager_be.mdb"" /wrkgrp ""c:\Program Files\Med Info Manager\secure.mdw""", 1)


B-)
 
You know, sometimes commands like that don't seem to work in the On Action box in my custom toolbar items. (For example, I can't get MsgBox to work directly.)

What I end up doing is writing a public function in a module, then pointing the toolbar command to that function.

It might be a sloppy workaround, but it's the only way certain commands will work for me. Could this be an Access 97 bug?
 
Mike's response looks helpful, but I need to use a relative path name. Not eveyone that uses the application has the related files in the same place...Is this possible to do or am I dreaming?
 
Try this........ if you have no joy give me get back to me here!

Create a form, and place 2 unbound text boxes on it.
Name one "txtAppPath" and the other "txtDocPath". Save the form as "frmRunApp"

Now create a macro called mcrRunApp and set the first action of the macro to "RunApp". For the "Command-line" type:

=[Forms]![frmRunApp]![txtAppPath] & " " & Chr(34) & [Forms]![frmRunApp]![txtDocPath] & ".doc" & Chr(34)

Now open frmRunApp in design view and add a command button, with on_click event set to run macro mcrRunApp.

Now open your form and type your required app and doc paths into the text boxes. Then click your command button!

It should now open the designated app, and then the file.

To take this further you could make these combo-boxes based on tables of your app paths, etc.


Good luck B-)
 
oops, from the command-line part, remove the [& ".doc"] part and include the file extension in your text box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top