This may be of some use
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"
'Const strdb = "c:\unclas\IPGenerator\db_IPGenerator.mdb"
'Const strdb = "D:\Jo-2\edl\db_IPGeneratorV2.mdb"
'Const strdb = "D:\Jo-2\jo\Issues.mdb"
DoCmd.Minimize
applaccess.Visible = True
'applaccess.DoCmd.OpenForm "frmEmployeeNameDialog"
comLaunchLinkAppserrexit:
Err = 0
Exit Sub
'Const strdb = "D:\Jo-2\edl\db_IPGeneratorV2.mdb"
'Const strdb = "D:\Jo-2\jo\Issues.mdb"
COMLaunchLinkAppserr:
MsgBox Error$(Err)
GoTo comLaunchLinkAppserrexit
End Sub
Function ListedPath(objname As Variant) As String
'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
.FindFirst "[objectname] ='" & objname & "'"
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
Exit Function
ListedPatherr:
MsgBox Error$(Err) & Err
GoTo ListedPatherrexit
End Function