Open Access DB from another Access DB (1 Viewer)

Maritza

Information *****
Local time
Today, 03:24
Joined
Nov 13, 2002
Messages
54
I was tasked to create like a Desktop Station that would allow the users access to all our Access databases without searching all over our network. I can do this really easy by creating links to the databases on a main form, but I don't want to have more than one instance of access open at a time. I have a command button with the following code:

Private Sub cmdTracker_Click()
strDataPath = "Database Path and name over the Network"
OpenDBs
End Sub

Sub OpenDBs()
Set appAccess = GetObject(, "Access.application")
If Err Then
MsgBox "Application not Running"
blnRunning = True
Set appAccess = GetObject(, "Access.application")
End If

appAccess.OpenCurrentDatabase (strDataPath), False

At this point if the database I'm trying to open is already open I get the error message Runtime error 7867 - "You already have the database Open"

The databases are located all over the network. We are using Windows XP and Access 2000. Do we have samples in the Forum that will help me accomplish this goal, or do any of you knows how to make it work?

Thanks,
Maritza :confused:
 

Mile-O

Back once again...
Local time
Today, 03:24
Joined
Dec 10, 2002
Messages
11,316
Why don't you want more instance open at a time? If you have a front end and back end setup then this shouldn't be an issue.
 

Maritza

Information *****
Local time
Today, 03:24
Joined
Nov 13, 2002
Messages
54
Open Access DB from Access

It's my understanding (please correct me if I'm mistaken), that the more applications we have open the more memory we are using. We have around 80 employees that may need access to any of the DBs at one particullar point in the day. They also use and keep open all day applications like Excel and Word. We all have folders in the network, to have data in our hardrives "is not recommended". I worked exclusively with Visual Basic years ago with and Access backend and was able to open the DBs without a problem. Unfortunately I can't find the code, and don't remember all of it.
 

ghudson

Registered User.
Local time
Yesterday, 22:24
Joined
Jun 8, 2002
Messages
6,195
Windows XP handles the memory allocation a lot better than previous versions of Windows. I do not have the hardware issues like I did when I was using Windows 98. Your users should be fine opening the programs and applications they want and need to do their job with Windows XP.

Keeping a program open all day is better than opening and closing it through out the day.
 

Smilie

Registered User.
Local time
Yesterday, 19:24
Joined
Jun 22, 2004
Messages
32
I am trying to open a secondary database from within the first. I am trying to use the code that you posted, Maritza. I put it as the event procedure for a command button. But it doesn't work for me. It gets caught on "strDataPath". I don't use VB very often. So, it is difficult for me to understand when I am making a mistake.

I basically copied your code exactly, except put a real file name where yours says Database Path and name over the Network.

Any suggestions would be much appreciated! (I am fine with multiple access applications running at once.)

Thanks!
 

Maritza

Information *****
Local time
Today, 03:24
Joined
Nov 13, 2002
Messages
54
Open Access DB from within another Access DB

Smilie,
Don't forget to declare your variables. In this case under General Declarions declare
Dim strDataPath as string

Also, in the path name, if it's over the network, don't use the drive's letter, (ie C:\, D:\), but the drives name instead, and don't forget the open and close quotes ""

strDataPath = "\\NameOfyourDrive\NameOfFolder1\NameOfFolder2\NameOfYourDB.mdb"

OpenDBS is a Subroutine within your module



Private Sub cmdTracker_Click()
strDataPath = "Database Path and name over the Network"
OpenDBs
End Sub

Sub OpenDBs()
Set appAccess = GetObject(, "Access.application")
If Err Then
MsgBox "Application not Running"
blnRunning = True
Set appAccess = GetObject(, "Access.application")
End If

Try that, if you still need more help send me a copy of your code and I will gladly look at it.
 

Users who are viewing this thread

Top Bottom