Connecting Tech Pros Worldwide Forums | Help | Site Map

how can I run a code/macro in a different database

WindAndWaves
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi there,

Can anyone tell me how I can run code/macro in a different database???
Below are the two situations where this may be applicable.

1. run a macro/code in another database that sends a file. I do not want
these tables/code/queries etc... to be part of my standard database, because
only some customers use this extension

2. close the current database, rename it and copy a new database (either
from an FTP or a server location) to the location and name of the one we
just closed.

TIA

- Nicolaas



James Fortune
Guest
 
Posts: n/a
#2: Nov 13 '05

re: how can I run a code/macro in a different database


"WindAndWaves" <access@ngaru.com> wrote in message news:<cdGNc.6119$N77.331697@news.xtra.co.nz>...[color=blue]
> Hi there,
>
> Can anyone tell me how I can run code/macro in a different database???
> Below are the two situations where this may be applicable.
>
> 1. run a macro/code in another database that sends a file. I do not want
> these tables/code/queries etc... to be part of my standard database, because
> only some customers use this extension
>
> 2. close the current database, rename it and copy a new database (either
> from an FTP or a server location) to the location and name of the one we
> just closed.
>
> TIA
>
> - Nicolaas[/color]

Have you considered the possibility of having your Access DB use
Access Automation on the other Access DB?

James A. Fortune
WindAndWaves
Guest
 
Posts: n/a
#3: Nov 13 '05

re: how can I run a code/macro in a different database


no, how would i do that?

Thank you for your answer James


James Fortune
Guest
 
Posts: n/a
#4: Nov 13 '05

re: how can I run a code/macro in a different database


"WindAndWaves" <access@ngaru.com> wrote in message news:<KmAPc.8313$N77.413491@news.xtra.co.nz>...[color=blue]
> no, how would i do that?
>
> Thank you for your answer James[/color]

Microsoft KB Article 222101:

http://support.microsoft.com/default...01&Product=acc

suggests resources for doing Automation. You need to see a picture of
Access' Object Model for the version of Access you are using. Allen
Browne's DAO Object Model image is also potentially useful:

http://members.iinet.net.au/~allenbrowne/ser-04.html

Automation should be able to handle the two cases you mention. For
2), you should grab the 'current database' from another database that
does the automation and handles closing it, renaming it, copying the
new one to the old location and opening the new one. If finding the
'current database' causes you trouble, try opening the 'current
database' originally from the other database and keep a handle of that
instance. Note that automating Access is trickier than automating
other Office products since they have the ability to record actions
and produce VBA code corresponding to those actions. Someone familiar
with coding VBA in Access should be able to figure it out anyway.

James A. Fortune
Closed Thread