Opencurrentdatabase (without open a new database)

Jan 20, 2015
Reaction score

The code below is working but i want i don't need to open a new database.

Can someone help me with the code change, i need this connection but to use on a open database.

And i can't use Currentdb because i want to link to another database that is opened too.

Private Sub Command25_Click()
Dim strAppName
Dim strAppFrontEnd
Dim db As Access.Application
Set db = CreateObject("Access.Application")
strAppName = "Complaints1"
strAppFrontEnd = "Complaints07.mdb"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
' Get User Profile
strUserProfile = oShell.ExpandEnvironmentStrings("%USERPROFILE%")
pathdb = strUserProfile & "\" & strAppName & "\" & strAppFrontEnd
db.OpenCurrentDatabase (pathdb)
teste = db.Forms!Gestion!txtTextoReclamacion
End Sub

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