Scripting from a button

G

Gary McQuigg

Can I do this in access?
I have three folders Root X, sub-folder Y and sub,sub-folder Z
MyMdb.mdb resides in Z

If I create a form>button with this code, in MyMdb.mdb it works as I expect.
DoCmd.OpenReport "MyMdb Report", acViewNormal

I want to create a form (button palette) in X to do the same thing.
How do I (can I) add the path as:
{path}DoCmd.OpenReport "MyMdb Report", acViewNormal
 
S

Scott McDaniel

Can I do this in access?
I have three folders Root X, sub-folder Y and sub,sub-folder Z
MyMdb.mdb resides in Z

If I create a form>button with this code, in MyMdb.mdb it works as I expect.
DoCmd.OpenReport "MyMdb Report", acViewNormal

I want to create a form (button palette) in X to do the same thing.
How do I (can I) add the path as:
{path}DoCmd.OpenReport "MyMdb Report", acViewNormal

Do you mean you want to open a Report in the MyMDB.mdb, wihich is NOT the current database?

If that's the case, you can do so through automation:

Dim acc As Access.Application

Set acc = New Access.Application
acc.OpenCurrentDatabase "Full Path to your DB"
acc.Visible
acc.DoCmd.OpenReport "Name"

Of course this begs the question: Why not just move the report to the database in the X folder? That'd be much easier
(and faster) than automating another instance of Access ... you can link the tables to run the report (if need be) from
another source, and you can even do so dynamically ...

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
G

Gary McQuigg

Scott McDaniel said:
Do you mean you want to open a Report in the MyMDB.mdb, wihich is NOT the
current database?

If that's the case, you can do so through automation:

Dim acc As Access.Application

Set acc = New Access.Application
acc.OpenCurrentDatabase "Full Path to your DB"
acc.Visible
acc.DoCmd.OpenReport "Name"

Of course this begs the question: Why not just move the report to the
database in the X folder? That'd be much easier
(and faster) than automating another instance of Access ... you can link
the tables to run the report (if need be) from
another source, and you can even do so dynamically ...

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com

I've decided to rethink my strategy. Thanks!
Access guy retired but left instruction.
Paradox guy (me) will retire soon.
I've been asked if I can smooth this up.
I have 4 mdb's with 2 to 15 reports per mdb.
Every report is:
Get data from excel
Run query(s)
Save a report to word
Email reports.

My goal is to script these items in Access 2007 to buttons and ship the file
to a folder as an html file.

I would appreaciate any hints if you see an error in my strategy.
Also; I'm looking for a mid-level book on Access 2007.
Most I have looked don't go this far and VB books start a little (lot) over
my head.
 

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