Open an external database

umair434

Registered User.
Local time
Yesterday, 20:49
Joined
Jul 8, 2011
Messages
186
Hi,

I want to open a database application, shared among the users on a common drive, by clicking on a button on a form in another database.

So far, I have been using


Private Sub Command0_Click()
Dim strDB As String
strDB = "C:\Documents and Settings\umair.khan\Desktop\PC-Docs_FE.accdb"
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True
End Sub



this works for my login - but how do I make it available for all the users? The database is placed on user's My documents/Trusted location.


Please advise.

Thanks!
 
Try changing this line of code
Code:
strDB = "C:\Documents and Settings\umair.khan\Desktop\PC-Docs_FE.accdb"
to
Code:
strDB = "C:\Documents and Settings\Environ("UserName")\Desktop\PC-Docs_FE.accdb"

if the document was on each users' desktop. Use Environ and then designate the correct path.
 
Try changing this line of code
Code:
strDB = "C:\Documents and Settings\umair.khan\Desktop\PC-Docs_FE.accdb"
to
Code:
strDB = "C:\Documents and Settings\Environ("UserName")\Desktop\PC-Docs_FE.accdb"

if the document was on each users' desktop. Use Environ and then designate the correct path.


I change the code, but it gives me an error "Expected end of statement" -



What's wrong?
 

Users who are viewing this thread

Back
Top Bottom