Switching from Powerpoint to Access

R

Richard Troy

Help!

I have used the following VBA code to open MyDatabase.mdb from a button on
my PP Presentation which has the advantage of not exiting the presentation
to use database illustrations.

Private Sub ViewDatabase_Click()
Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\Office\MSACCESS.exe
C:\MyDatabase.mdb"
Call Shell(stAppName, 1)
End Sub

However, I would prefer to directly open a specified form (MyForm) within
the database
from the said button.
Can anybody suggest the code I need to add ?

Would appreciate help.

Dick Troy
 
D

Douglas J. Steele

There are two options.

1 is to go under Tools | Startup on the menu, and set MyForm as the start-up
form.

2 is to create a macro (let's call it MyMacro) that opens the form, and then
tell Access to run that macro when it opens:

stAppName = """C:\Program Files\Microsoft Office\Office\MSACCESS.exe"" " &
"""C:\MyDatabase.mdb"" /x MyMacro"

(If you name the macro AutoExec, it'll automatically open without requiring
the /x switch, but that's no different than setting the form to run at
startup)

Note that I've put extra quotes in the string above: since the file path to
msaccess.exe includes blanks, you really should have them.
 
R

Richard Troy

Doug,

Many thanks for your prompt reply. Option 2 seems exactly what what I am
looking for but I an still struggling:
1. On button push within Powerpoint I want to open MS Access which I am able
to do with the code below.
2. Your option suggests that I can add code "/xMyMacro" to my PP code that
tells MS Access that, upon opening, it should run MyMacro (a procedure
within Access) to open the specified form. If I can do this I am home.
3. Is your " /x MyMacro" the precise addon to my line of code ?

Dick Troy
 
R

Richard Troy

Doug,

I am making progress. I can now run MyMacro within MS Access after I open it
from PP. However I want to be able to open many Access form as part of my
presentation. Do I need a unique Acces macro for each form or is there a way
I can stipulate the form I want, by name, from within the PP code.
Thanks for your help,

Dick Troy
 
D

Douglas J. Steele

You can pass any test you want using the /cmd flag in the shortcut. See
Command in the help file for how to read what you've passed that way: you
should be able to use it to launch the specific form.
 

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