Opening up other 2007 db from Access 2007

GovtWerker

Registered User.
Local time
Today, 07:13
Joined
Jun 19, 2012
Messages
10
I have a database that is/was very useful. It has as Table that contains the paths (K:\whereever\folderx\), getMDB (the database name). It's worked fantastic in 2003, but now most of the databases we run are now in Access 2007. Access 2003 won't link to or open up Access 2007, so I've reluctantly been forced to convert the database to 2007. And of course, it bombs and I can't get it to open up another database. Any ideas on how to get this to work? if I can get this to work, I'll be set for another 7 or 8 years until we move to Access 2010.


it is crashing on RetVal = Shell(theLine, vbMaximizedFocus)



Private Sub cmbxTR_AfterUpdate()
'when choice is made from dropdown menu
On Error GoTo Err_hand
Dim acc As Object
Dim RetVal As String
Dim theLine As String
Dim checkpt As String
Dim OpenAccess
Dim rs As DAO.Recordset
'Dim acc As Access.Application
checkpt = Me.cmbxTR.Value
OpenAccess = "C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE "
'Open the table again to get the database names
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblDROPDOWN_MDB order by [Get_order];")
Refresh
Repaint
Do While Not rs.EOF

'Get the name of the variables
MyMdb = rs!GET_MDB
myPath = RTrim(LTrim(rs!GET_PATH))
MyOrder = RTrim(LTrim(rs!GET_ORDER))
MyLevel = rs!Get_Level

If checkpt = MyMdb Then

Set acc = CreateObject("Access.Application")
theLine = OpenAccess & myPath & MyMdb & ".accdb"

'This code opens the selected database and closes the Bill-Board Database
RetVal = Shell(theLine, vbMaximizedFocus)

rs.Close
Set rs = Nothing
Set acc = Nothing
Me.cmbxTR.Value = " "

Else
'Move to the next record in the recordset
rs.MoveNext
End If

Loop
rs.Close
Set rs = Nothing
Set acc = Nothing

Err_hand:
If Err.Number = 91 Then
DoCmd.RunMacro "autoexec"

Else
If Err.Number <> 0 Then
MsgBox "This is your error: " & Err.Description & " " & Err.Number, vbCritical
DoCmd.Quit
Else
End If
End If
End Sub

Govtwerker
 

Users who are viewing this thread

Back
Top Bottom