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!

On click, close database and open another one... 1

Status
Not open for further replies.

Techniproshop

Programmer
Apr 24, 2007
50
0
0
CA
I've been surfing the web for hours and still can't find the answer. All I want to do is, on click or on open a form, close the database I'm in and open another one. Anybody could tell me how?

Thanks!
 
In one of my databases I open another database using the following lines of code:

stAppName = "msaccess.exe \\rdc1\CPRP\WorkingEmployeeRoster\DBMaint.mdb"
Call Shell(stAppName, 1)


Make sure you change the \\rdc1\CPRP\WorkingEmployeeRoster\DBMaint.mdb to reflect where your database is.

Hope this gets you started in the right direction.
Lena
 
Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "Path\filename"
'to close current db
quit
 
Lena, I used your code but I get that error:

"Microsoft Access encountered an invalid path to a data access page. You may need to re-create a page link"

"Microsoft Access is unable to open the data access page"

Here's my code:

stAppName = "msaccess.exe \\M:\ADMIN\Clerks\DATABASES\INSTAL\RunUpdate.mdb"
Call Shell(stAppName, 1)

why is it trying to open a data access page?
 
Code:
stAppName = "msaccess.exe [COLOR=red]\\M:\ADMIN\Clerks\DATABASES\INSTAL\RunUpdate.mdb"
[/color]

Should be
Code:
stAppName = "msaccess.exe [COLOR=blue]M:\ADMIN\Clerks\DATABASES\INSTAL\RunUpdate.mdb"
[/color]
 
Ok so I used pwise's code and it works fine.
Thank you both for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top