I would like to be able to open 4 seperate Access DB's from 1 access DB. Basically I want a form with 4 buttons, depending on which one the user pushed a different access DB would open...any suggestions. Thanks!!! Mike
I used it to open an IP Generator and issuues modules of a migration suite.
hence the paths and comments rem'd out at the bottom.
Edit where you need to.
To make all this function you have to
create a table - tbldirectoryPath - this will hold the paths to your databases.
Field name Type Size
----------------------------------------
directory text 50
subDirectory text 50
Name text 50
Objectname text 50
objectType text 50
example of record
directory
e:\ip applications\db_issues
subDirectory
Name
Issues Database
Objectname
issues.mdb
objectType
Database
copy these 2 routines into a module after creating and populating your table and then run them ..
any probs let me know and I'll check them out
appname is the name of your database to be opened including the .mdb
so if your database is say Salary.mdb
on your button you would put
Call launchLinkApps("salary.mdb"
and you are away
regards
Jo
Sub launchLinkApps(appname As String)
On Error GoTo COMLaunchLinkAppserr
Dim strdb As String
Dim strname As String
Dim applaccess As New Access.Application
Dim strFile As String
Dim rptpath As String
Dim response As Integer
Dim cnt As Integer
ChDir "C:\"
Dim rptname As String
Dim dirstr As String
rptname = appname
cnt = 0
rptpath = ListedPath(rptname) ' this reads the path from form data
ChDir rptpath
If CurDir <> rptpath Then
ChDir rptpath
End If
dirstr = rptpath & "\"
DoEvents
DoEvents
'The next 3 line opens the database
strdb = dirstr & appname
applaccess.Visible = True
applaccess.OpenCurrentDatabase strdb
'MsgBox "This application is not included in this suite of programs. " & vbCrLf & " Please contact your administrator"
'j green
'This function retrieves the value of the directory path field from tbldirectoryPath
'and returns it to the function ..... so that the output can be created in the right place
On Error GoTo ListedPatherr
Dim mydb As Database
Set mydb = CurrentDb()
Dim myrs As Recordset
Set myrs = mydb.OpenRecordset("tblDirectoryPaths", dbOpenDynaset)
With myrs
If .NoMatch Then
MsgBox objname & "Cannot be located." & vbCrLf & "Please contact your Line Manager and report the object has been removed"
Else
ListedPath = !directory
End If
End With
ListedPatherrexit:
Err = 0
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.