Any thoughts would be greatly appreciated.
The Helpfile example sub display form() below was run and returned the northwind.mdb form "orders", but when I plugged in my own variables, nothing seems to appear.
Sub DisplayForm()
'Dim appAccess As Access.Application ' dimensioned in the head declarations
Dim strDB as String
' Initialize string to database path.
Const strConPathToSamples = "C:\Program " _
& "Files\Microsoft Office\Office11\Samples\"
strDB = strConPathToSamples & "Northwind.mdb"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open Orders form.
appAccess.DoCmd.OpenForm "Orders"
End Sub
================I ran the helpfile code above and it gives you the access database window (northwind.mdb) and the form "Orders" as expected
================Same code below, but with my variables does not return the new access database window (remote.mdb) nor the form "frmRemote".
Function triggerit()
'Dim appAccess As Access.Application ' dimensioned in the head declarations
Dim strDB As String
strDB = "C:\Documents and Settings\Central\Desktop\remote.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB, True
' Open Orders form.
appAccess.DoCmd.OpenForm "frmRemote"
End Function
when I call function triggerit (), i.e. "call triggerit" from the intermediate window, it looks like it runs but I don't get the new access window or the form.
When I try to run triggerit again, I get an error message that makes sense "Microsoft Access can't open the database because it is missing, or opened exclusively by another user"...but I don't see the access window or the form (not even in the windows task manager "applications" tab via the ctl+alt+delete.
I try to delete or move the remote.mdb and I get a similar error "it is being used by another person or program"...but the mdb doesn't appear visible.
I've since gotten the opencurrentdatabase method to work opening a different mdb, but I've since also tried the opencurrentdatabase method to open another mdb, but it didn't work.
Any thoughts would be much appreciated.
Thanks.
Noel
The Helpfile example sub display form() below was run and returned the northwind.mdb form "orders", but when I plugged in my own variables, nothing seems to appear.
Sub DisplayForm()
'Dim appAccess As Access.Application ' dimensioned in the head declarations
Dim strDB as String
' Initialize string to database path.
Const strConPathToSamples = "C:\Program " _
& "Files\Microsoft Office\Office11\Samples\"
strDB = strConPathToSamples & "Northwind.mdb"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open Orders form.
appAccess.DoCmd.OpenForm "Orders"
End Sub
================I ran the helpfile code above and it gives you the access database window (northwind.mdb) and the form "Orders" as expected
================Same code below, but with my variables does not return the new access database window (remote.mdb) nor the form "frmRemote".
Function triggerit()
'Dim appAccess As Access.Application ' dimensioned in the head declarations
Dim strDB As String
strDB = "C:\Documents and Settings\Central\Desktop\remote.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB, True
' Open Orders form.
appAccess.DoCmd.OpenForm "frmRemote"
End Function
when I call function triggerit (), i.e. "call triggerit" from the intermediate window, it looks like it runs but I don't get the new access window or the form.
When I try to run triggerit again, I get an error message that makes sense "Microsoft Access can't open the database because it is missing, or opened exclusively by another user"...but I don't see the access window or the form (not even in the windows task manager "applications" tab via the ctl+alt+delete.
I try to delete or move the remote.mdb and I get a similar error "it is being used by another person or program"...but the mdb doesn't appear visible.
I've since gotten the opencurrentdatabase method to work opening a different mdb, but I've since also tried the opencurrentdatabase method to open another mdb, but it didn't work.
Any thoughts would be much appreciated.
Thanks.
Noel