Would it still work the same if I put this in a module in another Access file? I got it where the window opens but then closes immediately after. Here is the code I have, any help why you think it might not be working would be greatly appreciated.
**********Code Start**********
Option Compare Database
Public Function OpenDB()
Dim db
Dim strDbName
Dim strPassword
strDbName = "L:\New Reporting DBs\Reports.accdb"
strPassword = "MyPassword"
Set acc = CreateObject("Access.Application")
' this temporarily changes the macros security to low to avoid messages.
'onlt works with access 2000 onwards
If acc.SysCmd(7) >= 10 Then
acc.AutomationSecurity = 1
End If
acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=" & strPassword)
acc.OpenCurrentDatabase strDbName
End Function
**********Code End**********
Thanks,
JB